Как определить, возвращает ли селектор значение null?

if ( $("#anid").length ) {
  alert("element(s) found")
} 
else {
  alert("nothing found")
}

addclass

jquery

jquery-selectors

2022-09-06T13:48:17+00:00