What is the correct way to use variables in JQuery?
- by Jared Christensen
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?
});