Friday 26 March 2010

How do test whether an element exists or not?

You can use the length() function of the jQuery:

if( $('#myDiv').length > 0 )
  $('#myDiv').show();


Cheers!

No comments:

Post a Comment