Is it possible, in either the jQuery API or the DOM, to check if an element exists on the page or not?
Consider these two variables:
var selected = $('span#mySpan');
var created = $('<span id="mySpan">Testing</span>');
Both will return a jQuery object containing a span element. Is there any way to tell that the first exists on the page, and the second one does not?