+ 1

Js alternatives?

Is there a pure JavaScript alternative to .append() in jQuery? This is for my code https://code.sololearn.com/Wp3feOX200z6/?ref=app

14th Jun 2018, 4:06 PM
🅿️®️⭕️_e✖️e
🅿️®️⭕️_e✖️e - avatar
2 odpowiedzi
+ 1
jQuery: $( "#blk" ).append( "<p>Text</p>" ); JavaScript alternative way: var pElement = document.createElement("p"); var textNode = document.createTextNode("Text"); pElement.appendChild(textNode); document.getElementById("blk").appendChild(pElement);
15th Jun 2018, 1:46 AM
Calviղ
Calviղ - avatar
14th Jun 2018, 5:14 PM
Mickel
Mickel - avatar