我正在尝试针对具有相同 id
的对象执行效果,但它仅适用于第一个:
$("#continue").addGlow({ .. etc.. });
我该如何进行这个?
最佳答案
你不能。这是 HTML 标准的结果。正如彼得在上面的评论中提到的,你应该使用类。您所做的不仅是不好的做法,而且在旧版、移动版甚至某些主流浏览器上可能会出现未指定的行为。
http://www.w3.org/TR/WD-html40-970708/struct/global.html
id = name
This attribute assigns a document-wide name to a specific instance of an element. Values for id must be unique within a document. Furthermore, this attribute shares the same name space as the name attribute.
(强调我的)
关于jquery - 影响相同ID的多个元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8828814/