admin管理员组文章数量:1289911
I think the answer is probably "no," but I wanted to get the opinion of people who know a lot more than me. Can you use the "id" attribute with HTML elements in the head section, such as title or link? The purpose would be to change their values with JavaScript. Thanks in advance.
I think the answer is probably "no," but I wanted to get the opinion of people who know a lot more than me. Can you use the "id" attribute with HTML elements in the head section, such as title or link? The purpose would be to change their values with JavaScript. Thanks in advance.
Share Improve this question asked Jan 13, 2016 at 17:15 freginoldfreginold 3,9563 gold badges15 silver badges29 bronze badges 2- You can, what are you trying to do? – Pavel Durov Commented Jan 13, 2016 at 17:18
- Possible duplicate of Is it okay to add id/class to <link> tag? – Drew Kennedy Commented Jan 13, 2016 at 17:19
3 Answers
Reset to default 15Yes. All HTML elements support the ID attribute.
See the spec:
The following attributes are mon to and may be specified on all HTML elements (even those not defined in this specification):
…
id
Yup. Every html element supports an id:
<head id="everyone"/>
The id
attribute is a Global Attribute
Yes, you can use an id
attribute in a head
element. Further, here is the full list of Global Attributes and they may be specified on all HTML elements.
- accesskey
- class
- contenteditable
- dir
- hidden
- id
- lang
- spellcheck
- style
- tabindex
- title
- translate
本文标签: javascriptCan you use IDs with HTML head tagsStack Overflow
版权声明:本文标题:javascript - Can you use IDs with HTML head tags? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741484121a2381322.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论