adding id to element javascript code example
Example 1: add id to element javascript
myPara.setAttribute("id", "id_you_like");
Example 2: javascript add id to element
myelement.id = yourid;
myPara.setAttribute("id", "id_you_like");
myelement.id = yourid;