how to make check if using jquery object exists code example
Example 1: check element exist in jquery
if ($('.element').length) {
// there is at least one element matching the selector
}
Example 2: Is there an “exists” function for jQuery
if ($(selector).length)