To check whether an element exists using jQuery

Avidnyat

To check whether element is present or not use following code in jQuery:-

If we use following code for checking tag it will always return true as
jQuery always returns object.

if($(‘checkbox’)){

}

Correct way to do this is as follows:-

if ($(‘checkbox’).length > 0) {

}

about the author

Avidnyat

  1. buy12 inch Virgin Brazilian Hair

    December 21, 2012

    Perhaps, presently in a number of components of planet earth persons make use of hairpiece for similar role.

  2. Prudence85966

    February 20, 2013

    After I open up your Feed it appears to be to be a ton of nonsense, is the problem on my part?