jQuery performance, .css or addClass
问题 I have a big jQuery code and I am thinking at speed performance of my functions. When an element is clicked (mousedown) i need to assign an image as background. I can do this by 2 ways: $('#element li.class').css({"background":"someimageURL"}); or $('#element li.class').addClass("someclass"); where "someclass" have the actual CSS background image. Witch function works better in this case. Is there a way to test various functions speed? Thank you 回答1: I'm almost certain .addClass() would be