jquery detect if element has ::after code example Example: jQuery exists function if ($("#myElementID").length){ //I exist }