I find myself doing this a lot, for specific properties for animation purposes, and specially when I'm generating something using database values obtained through PHP. Is there a reason not to do this.
Some sample code, to clear up ambiguity.
This would be the JQuery:
$('.class').each(function(){
var my_new_width = $(this).attr('id');
$(this).stop(false, true).animate({width: my_new_width}, 100);
});
HTML would be:
<img id='100' src='path'/>
Obviously this code offers no functionality, and is meant to be used with a .hover()
or something. Just wanted to clear up the ambiguity in the question.