title: How do I get the CSS width value with Javascript?
body: <p>I'm trying to calculate the width of an element so that when I use JavaScript to wrap a parent element around it, I can set the width of the parent to match the width of the child.  The obvious <code>$('#element').css('width');</code> isn't quite what I want because it only seems to return the calculated value in pixels.  Is there some way that I can return the actual CSS value, whether it be <code>300px</code> or <code>20%</code> or <code>auto</code>, instead of the calculated value?</p>
  
  <p>Here's generally how it's set up, but I'd like to know the CSS value of <code>#child</code> instead of the calculated value.</p>
  
  <pre><code>$(document).ready(function(){
      $('#child').wrap('&lt;div id="parent"&gt;&lt;/div&gt;');
      $('#parent').each(function(){
          var childWidth = $(this).children('#child').css('width');
          $(this).css('width', childWidth)
      });
  });
  </code></pre>