by @kodeazy

javascript How to modify id value in HTML tag?

Home » javascript » javascript How to modify id value in HTML tag?
  • With the help of setAttribute method we can modify the value of id inside any HTML tag.
  • Below is the syntax of modifying the id value of a HTML tag.

    document.getElementById("oldId").setAttribute('id','newId');