jquery 检测元素是否存在的实例代码

(编辑:jimmy 日期: 2024/10/14 浏览:2)

if ($('#myDiv).length) { 
    // your code 
}

 Simple, but not obvious.