What is the correct way to use variables in JQuery?
Posted
by Jared Christensen
on Stack Overflow
See other posts from Stack Overflow
or by Jared Christensen
Published on 2010-05-06T19:51:18Z
Indexed on
2010/05/06
19:58 UTC
Read the original article
Hit count: 212
jQuery
I want to reference an element once and then reuse it threw out my code but I'm not sure the correct way. Below is what I tried but it only works in some places.
$(document).ready(function() {
var image = $("#content img");
image.wrap("<span />"); // Works!
image.hover(function(){}, function(){}); // Does not work?
});
© Stack Overflow or respective owner