Answers for "javascript add text to li"

1

js add more text to element

document.getElementById("p").textContent += " This is the text from javascript.";

<p id ="p">This is the text from HTML.</p>
Posted by: Guest on June-18-2020
0

javascript add text to li

let arr = ["g", "o", "o", "g", "L", "e";
let ul = document.getElementById("id_ul");
let i =0;
arr.map(arr=>{
 var li = document.createElement("li");
 ul.appendChild(li);
 li.innerHTML = arr[i];
})
Posted by: Guest on July-31-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language