jQuery check if element exists if ( $('.target').length > 0 ) { $('.log').text('.target element exist'); }