check if object with selector exists code example Example: jQuery exists function if ($("#myElementID").length){ //I exist }