Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create label and check box dynamically in javascript?

Tags:

I want to create label and check box dynamically. when i enter text in text box and give submit button,a check box and label with the text i entered in text box should be created..How to create ?

like image 203
nirmal10 Avatar asked Sep 30 '11 09:09

nirmal10


1 Answers

For the label try this:

var newlabel = document.createElement("Label"); newlabel.setAttribute("for",id_from_input); newlabel.innerHTML = "Here goes the text"; parentDiv.appendChild(newlabel); 
like image 165
Dinkheller Avatar answered Sep 26 '22 18:09

Dinkheller