jQuery check if a div exists

jQuery check if a div exists

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