how to add id to createelement in javascript code example
Example 1: create element javascript with id
var btn = document.createElement('div');
btn.setAttribute("id", "div1");
Example 2: javascript add id to element
myelement.id = yourid;
var btn = document.createElement('div');
btn.setAttribute("id", "div1");
myelement.id = yourid;