This can be achieved by using .length if($("#id_name").length == 0) { //the element with id_name does not exists }