if( $('#selector').length ) // use this if you are using id to check { // it exists } if( $('.selector').length ) // use this if you are using class to check { // it exists }