To check whether an element exists, you can write the following code: if ($("#someElement").length) { //The DOM element exists } else { //The DOM element doesn't exist } Tagged: 2015Exists