Re:Intro to jQuery: Learn jQuery with Street Fighter and Had...
by carlsednaoui on Monday November 25, 2013 @02:43PM
(#6796401)
Hi sparkygoblue, author here, thanks for the feedback! As you mentioned in your edit, I tried to break every step into simple-to-follow pieces.
Def let me know if you have any other suggestions :)
var $image = $('#my-div img');
This way jQuery doesn't have to traverse the DOM more than once to select the element.
Also, I believe you can do all of your mousedown() event code in one block.
Edit: oops, upon further inspection, I see you are doing this all in the console. Caching the selector is still possible, but now I understand why you did the mousedown() event the way you did.