add id to html elements using js code example Example: javascript change element id var element = document.getElementById("oldID"); element.id = "newID";