How to check if an element exists in jQuery?

jQuery 1: find element by id

// find elements by id
if ($("#element_id").length > 0) { 
	// Do something
}

jQuery 2: find element by class

// find elements by element class
if ($(".element_class").length > 0){ 
	// Do something
}