jquery只获取所有带有id的html元素 [英] jquery get only all html elements with ids
本文介绍了jquery只获取所有带有id的html元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含许多 html 元素的 div,例如其他 div、trs、tds、表格等
I have a div with many many html elements like other divs, trs, tds, tables etc
是否可以获取所有具有 id 的元素?我知道询问 $("#test")
会给我这个 id 的特定元素
Is it possible to get all the elements which have an id?
I know asking $("#test")
will give me the specific element with this id
但是有可能得到 find("#")
或类似的东西吗?!
but is it possible to get find("#")
or something like this?!
推荐答案
$('[id]')
返回所有设置了 id 的元素
$('[id]')
returns all elements that have id set
这篇关于jquery只获取所有带有id的html元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文