What are the benefits of using attr() instead of using addClass() in jquery?
attr(a,b) sets an element's "a" attribute to "b".
addClass(a) adds the "a" class to an element
for example...
Html
Script
$("#box").attr("class", "myOtherClass");
Result
And...
Html
Script
$("#box").addClass("myOtherClass");
Result
jQuery Links:
http://api.jquery.com/attr/
http://api.jquery.com/addClass/