jquery判断元素是否存在
用于判断页面元素是否存在:
if ( $("#ID").length > 0 ) {
$("#ID").text("hi");
}
- 上一篇 »JavaScript判断数组是否存在key
- 下一篇 »python判断文件夹和文件是否存在
相关推荐
jquery 检测元素是否存在
if($('#myDiv).length){//yourcode}Simple,butnotobvious.
时间:2023-06-15 14:06
用于判断页面元素是否存在:
if ( $("#ID").length > 0 ) {
$("#ID").text("hi");
}
if($('#myDiv).length){//yourcode}Simple,butnotobvious.