add id attribute javascript code example
Example 1: add id to element javascript
myPara.setAttribute("id", "id_you_like");
Example 2: set attribute javascript
Element.setAttribute(name, value);
myPara.setAttribute("id", "id_you_like");
Element.setAttribute(name, value);