Does anyone know how to tell if a cached jQuery object has gone stale, e.g. is no longer in the DOM? For example:
var $cached_elem = $(\'.the_button\'); //
The native document.contains() method should be faster than jQuery to determine if a cached jQuery element exists in the DOM.
document.contains()
if (document.contains($cached_elem[0])) { // Element is still in the DOM }