jquery each to loop and animate
- by medk
I have some span tags:
<span w="560"></span>
<span w="340"></span>
<span w="120"></span>
With jQuery, I want to select EACH span, get the value inside its w attribute and animate it to that value + "px".
I have a simple code that didn't work:
$(document).ready(function(){
$('span').animate({width: $(this).attr('w') + 'px'}, 2000);
});
Any Suggestions?
Thanks.