javascript - jquery return value of a non-existing id or class? -


i need check if object has same id on dom, because trying create modal window library,

the problem in browsers console when write

$("#anonexistingid"); 

it returns []

but in code

if($("#"+id)!==[]){         return;     } 

just not work. proper way of defining empty array?(because think [] means empty array, maybe not not sure :d)

jquery returns object. can check it's length see if it's empty or not:

if($("#"+id).length !== 0){  } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -