How to grab the width attribute of an element using jQuery?
<p>I created a graph using html, now I want to give it a nice effect when it initially loads. I want the bars of the graph to fly in from the left. The code below does that, only problem is each bar ends up with 70% width (obviously since I set that in the jQuery code). Instead I need that number to be unique to the width set within the bars (span tags). I assume the answer would be something like:</p>

<pre><code>$(this).attr('width')...
</code></pre>

<p>but I can't get it to work, please help.</p>

<p>The Code:</p>

<pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"&gt;&lt;/script&gt;

&lt;style type="text/css"&gt;

div.graph { display: none; border: 1px solid red; height: 200px; width: 400px; margin: 0 auto; }

div.graph span { display: none; display: block; background: red; height: 20px; margin-bottom: 10px; }

&lt;/style&gt;

&lt;script type="text/javascript"&gt;
$(document).ready(function() {

    $('div.graph').fadeIn('slow');

    $('div.graph &gt; span').animate({
        width: "70%"
    }, 1500 );

});
&lt;/script&gt;

&lt;div class="graph"&gt;
    &lt;span style='width:10%'&gt;&lt;/span&gt;
    &lt;span style='width:40%'&gt;&lt;/span&gt;
    &lt;span style='width:25%'&gt;&lt;/span&gt;
    &lt;span style='width:15%'&gt;&lt;/span&gt;
    &lt;span style='width:10%'&gt;&lt;/span&gt;
&lt;/div&gt;&lt;!-- graph --&gt;
</code></pre>
