jquery判断元素是否被获取到

jQuery对象永远都有返回值,所以$("someID") 总是TRUE ,IF语句没有起到任何判断作用。

if ( $("#ID").length > 0 ) { 
$("#ID").text("hello"); 
}