if p has a test in it jquery code example Example: jQuery exists function if ($("#myElementID").length){ //I exist }