Recent Posts

Showing posts with label exists. Show all posts
Showing posts with label exists. Show all posts

"exists" function in jQuery

For verify the existence of an element in jQuery this is the piece of code:

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

if ($(selector).exists()) {
    // Do something
}