if ($(selector).length) {
    // Exists
}

Source: http://stackoverflow.com/a/587408

Published On: August 6, 2018Categories: jQueryTags: