jQuery: add an attribute to multiple elements with the same id or class

preview_player
Показать описание
In this video you will see how you can add an attribute to multiple elements with the same id or class with jQuery.
Рекомендации по теме
Комментарии
Автор

Working on a Chrome extension in order to add additional functionality to a specific website. I have to deal with the fact that the developers used ids instead of classes, so this workaround was very helpful :)

Silencer
Автор

id must be unique otherwise it is an invalid document. simply use class='new' and $('.new') rather than this unnecessary workaround

markbrown
Автор

crap, u can never ever, never ever use multiple instances of an id 

MohitManuja
join shbcf.ru