Q:

how to append in javascript

var colors=["red","white"];
colors.push("blue");//append 'blue' to colors
79
var colors= ["red","blue"];
	colors.push("yellow"); 
41
var div = document.getElementById('myElementID');
div.innerHTML += "Here is some more data appended";
7
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
7

 var node = document.createElement("LI");                 // Create a <li> node

 var textnode = document.createTextNode("Water");         // Create a text node

 node.appendChild(textnode);                              // Append the text to <li>

 document.getElementById("myList").appendChild(node);     // Append <li> to <ul> with id="myList" 
4
var list=[1, 2, 3, 4, 5];
list.push(6);
// .push allows you to add a value to the end of a list 
3
convert string to byte
0

New to Communities?

Join the community