Click here to Skip to main content
15,913,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to create textfield in form using javascript
Posted

 
Share this answer
 
Comments
DeepthiTanguturi 24-Dec-11 3:57am    
i want in javascript
srinivas vadepally 24-Dec-11 4:33am    
http://www.java2s.com/Code/JavaScript/Form-Control/AddtextfielddynamicallyintoHTML.htm
Try following:
XML
<head>
<title></title>
<script language="javascript">
    fields = 0;
    function addInput() {
        if (fields != 10) {
            document.getElementById('text').innerHTML += "<input type='text' value='' /><br />";
            fields += 1;
        } else {
            document.getElementById('text').innerHTML += "<br />Only 10 upload fields allowed.";
            document.form.add.disabled = true;
        }
    }
</script>
</head>
<body>
<form name="form">
<input type="button" onclick="addInput()" name="add" value="Add input field" />
</form>
<div id="text">

</div>
</body>
</html>
 
Share this answer
 

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