jquery exists code example
Example 1: jquery check if element exists
// Check if an element currently exists
if ($('#element').length) {
}
Example 2: check element exist in jquery
if ($('.element').length) {
// there is at least one element matching the selector
}
Example 3: Is there an “exists” function for jQuery
if ($(selector).length)
Example 4: jQuery exists function
if ($("#myElementID").length){
//I exist
}