DEV Community

Discussion on: Add Dynamic Id to class with jquery

Collapse
 
link2twenty profile image
Andrew Bone

You can do it with pure JavaScript too, a lot of the older jQuery syntax has made it into mainstream JavaScript now 🙂

document.querySelector('div.class').setAttribute('id', 'yourIdName');