Click here to Skip to main content
15,907,497 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

pls anyone help me to solve this problem,

i want to create dynamic controls in html/javascript.

i have div, inside that div i use radio, textarea, select, link. so when i click button i need to show div dynamically.

i search ready many sites,according that i need to use append command, but not clear way.

pls anyone help me :)

[no name] 15-Sep-14 22:33pm

1 solution

Hi try the below code,

<input type="button" value="Add" onclick="add()" />
<div id="divEl"></div>

function add() {
    //Create an input type dynamically.
    var element = document.createElement("input");
    //Assign different attributes to the element.
    element.setAttribute("type", "button");
    element.setAttribute("value", "text");
    element.setAttribute("name", "radio");
    var divEl= document.getElementById("divEl");
    //Append the element in page (in span).

Hopes this will help for you......
Share this answer
Renga.g 19-Sep-14 0:16am    
hi thanks :) :) :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900