gpt4 book ai didi

jquery - 使用 jQuery 检查元素是否在 DOM 中?

转载 作者:行者123 更新时间:2023-11-30 23:49:02 25 4
gpt4 key购买 nike

我有一个快速而简单的问题。如何检查某个元素是否在 DOM 中?

例如我如何检查是否有
<p id="does_i_really_exist_or">this is just matrix</p>

最佳答案

if ( $("#does_i_really_exist_or").length ) {
//-- It does exist.
}

关于jquery - 使用 jQuery 检查元素是否在 DOM 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7119308/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com