Within document.ready, I store a selector in a variable (which I assume once evaluated, stores the element object in said variable), as I need to manipulate it many times.
ie. myVar = $('#mySpan');
What I'm storing is a span element within a div. One of the manipulations requires me to overwrite the contents of the div using the .html() function.
After, I need to reinsert that span element inside the div mentioned above and do so using the html() function.
The problem I have is that once the span element has been re-added, the variable myVar is no longer associated with the span element. I assume this is because it was deleted from the DOM and then re-added.
I know that jquery has the .detach() function, but that seems to only preserve attached events and data elements, but not actual references. I don't even thing the .live() function would help in this case either.