Create exists function in jQuery


/ Published in: jQuery
Save to your folder(s)

Great way to check if a node exists before running a piece of code.


Copy this code and paste it in your HTML
  1. (function($) { $.fn.extend({ exists: function() {return this.length>0;} }); })(jQuery)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.