jquery判断元素是否存在

用于判断页面元素是否存在:

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

posted on 2019-05-22 14:57  Mrnx  阅读(25338)  评论(0)    收藏  举报