Check if the jQuery selector matches any element


if($('yourselector').length > 0)
{//have element(s)

}

Keyword Reference
.length