Check if an element exists var exists = $('div.class').length > 0; exists - will contain true if an element exists div.class - selector to check existence of length - will return number of elements that match given selector