jQuery test if element exists

This is a small plugin for jQuery to test if an element exists in the DOM. 


Author: Anonymous
Added: Monday, 14 Jul, 2014
Category: jQuery
Tags: JavaScript

Code

$('selector').doesExist();

/* return true|false if an element exists */
jQuery.fn.doesExist=function(){return jQuery(this).length>0;};

Comments