check if given elem is jquery selector code example Example: jQuery exists function if ($("#myElementID").length){ //I exist }