Why do we use ev.target.appendChild(document getElementbyId(data)); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why do we use ev.target.appendChild(document getElementbyId(data));

20th Jun 2019, 2:59 PM
afsha tamboli
afsha tamboli - avatar
2 Answers
+ 1
Where did you see this statement? after getElementById(data), there should be .innerText
20th Jun 2019, 3:50 PM
Gordon
Gordon - avatar
0
//The method appendChild places a newly created element created with document.createElement inside of a parent. Use: var x = document.createElement(“div”); x.setAttribute(“id”,”abc”); x.classList.add(“aDiv”); document.body.appendChild(x); //This places the created div element inside of the body (I also gave it an id of abc and added the class aDiv). //Edit: ev is probably an object and target is a selector for an argument.
20th Jun 2019, 4:47 PM
YoBoi