javascript - Check if element exists -
possible duplicates:
is there “exists” function jquery
jquery determining if element exists on page
if(tr)
returning true when tr not element, how check whether it's element exists?
var tr = $('#parts-table .no-data').parent(); $('.delete', row).bind('click', function (e) { that.delete(e.currenttarget); }); console.log(tr); if (tr) //returns true when shouldn't
check length
property:
if(tr.length) { // exists }
if(tr)
evaluates true because jquery object, or any javascript object matter, truthy.
Comments
Post a Comment