January 28, 2015

jQuery check exists element call function

Function:
jQuery.exists = function(selector) {return ($(selector).length > 0);}
Usage:
if($.exists(".datetimepicker")){ $(".datetimepicker").datetimepicker({ pickTime: false }); }
There was an error in this gadget