jquery判断元素是否存在

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

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

原文地址:https://www.cnblogs.com/mrnx2004/p/10905935.html