
If want to check the specific Id already exists inside the site. you may using “length” to do it.
For Example:
if( $('#selector').length) {
     // it exists
}
if the length more then 0, that’s mean the following Id already exists inside the site.if you are using class to check
if( $('.selector').length) {
     // it exists
}