Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js add id to element

//creates div then assigns a reference of that object to myElement variable
let myElement = document.createElement('div') 
//myElement.setAttribute("type here", "customName here")
myElement.setAttribute("class", "myClassName")
myElement.setAttribute("id", "myUniqueIDName")
 
PREVIOUS NEXT
Tagged: #js #add #id #element
ADD COMMENT
Topic
Name
9+4 =