Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个 jQuery 对象,说它是一个表单的字段,我通过 id 查询它:
$("#my_field")
如何确定该对象的标签,特别是:它是标签还是输入?
您可以在对象上使用该tagName属性DOM
tagName
DOM
通过索引访问 jQuery 对象会为您提供DOM对象。
$('#my_field')[0].tagName
检查小提琴