问题:
This question already has an answer here: 这个问题已经在这里有了答案:
- Is there an “exists” function for jQuery? jQuery是否有“存在”功能? 41 answers 41个答案
How do I check if an element exists if the element is created by .append()
method? 如果该元素是由.append()
方法创建的,该如何检查该元素是否存在? $('elemId').length
doesn't work for me. $('elemId').length
对我不起作用。
解决方案:
参考一: https://stackoom.com/question/JGiT/检查jQuery中是否存在元素-重复参考二: https://oldbug.net/q/JGiT/Check-if-element-exists-in-jQuery-duplicate
来源:oschina
链接:https://my.oschina.net/u/4428122/blog/4492338