我有两个 ID 为#container 的div。
第一个 是类.current-content
[div#container -- div.current-content]
第二个包含在 .next-content 类中并包含 current-content
[div#container -- div.next-content -- div#container -- div.current-content]
可能只有一个 #container 类 .current-content 元素来自 second .current-content ?
最终如何做到这一点?
谢谢。 :)
最佳答案
Each id value must be used only once within a document. If more than one element has been assigned the same ID, queries that use that ID will only select the first matched element in the DOM. This behavior should not be relied on, however; a document with more than one element using the same ID is invalid.
关于javascript - 在 jQuery 中选择 DIV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21974414/