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

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -