JS Adicionar ID ao elemento
.setAttribute("id", "id goes here")
Code Cat
.setAttribute("id", "id goes here")
All currently used browsers:
element.id=id;
myElement.id=newId;
element.className=class;
myElement.className=newClassName;
var divEle= document.createElement('div');
divEle.id='firstDivId';