The method you can use to count the element’s of a jQuery selection is “size()”
$("div.class").size();
So you are able to do
if ($("div.class").size() > 0)
// Do something
else
// Another thing
or whatever you want to do
The method you can use to count the element’s of a jQuery selection is “size()”
$("div.class").size();
So you are able to do
if ($("div.class").size() > 0)
// Do something
else
// Another thing
or whatever you want to do