Recent Posts

Check the existence of an element in jQuery

jQuery.fn.exists = function(){return this.length>0;}

if ($(selector).exists()) {
    // Do something
}
This is in response to: Herding Code podcast with Jeff Atwood

No comments:

Post a Comment