📌  相关文章
📜  js 检查 dom 元素是否存在 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:19.185000             🧑  作者: Mango

代码示例2
var myElement = document.getElementById("myElementID");

if(!myElement){
    //#myElementID element DOES NOT exist
}

if(myElement){
    //#myElementID element DOES exists
}