if element id exist, jQuery

if($("#" + name).length == 0) {
  //it doesn't exist
}
Advertisements