Questions

ADD New DIV or Button within the HTML Document through Javascript

How to add new row within div in javascript:-
The createElement() and appendChild() function used to you can create a new div or input tags in the HTML document. The example code given below,




ADD New DIV or Button within the HTML Document through Javascript




row=1;
function addRow(){
row = row + 1;
var nd = document.createElement("div");
nd.setAttribute("id", "div_val_"+row);
nd.innerHTML ='AddRemove';
var out = document.getElementById("div_val_more");
out.appendChild(nd);
}
function Remove(i){
var outs = document.getElementById("div_val_"+i);
var parent = document.getElementById("div_val_more");
parent.removeChild(outs);
}



Name
Add





Your Answers

Your Name:
Your Answers :
<> is a code tag
Preview
Enter the verification code:

Answers

No Answers..