Posted By

daipratt on 01/08/10


Tagged

exists


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

davidsi


Test if an element exists in jQuery


 / Published in: jQuery
 

URL: http://daipratt.co.uk

  1. if ($("#id").length) {
  2. //it does!
  3. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: ReeceMarsland on January 8, 2010

used that bad boy the other day!

Posted By: gregorio on February 15, 2010

how bout - if($("#id")){} that works too.

You need to login to post a comment.