Jump to content

Create textbox


johnny-2step

Recommended Posts

Good day everyone.  I'm new to the forums.

 

I just wanted to ask if it is possible in javascript to make a script that when a user clicks a button a new textbox will appear.  If he clicks again, another textbox will then appear, so on and so forth.  Without having to refresh the page everytime he clicks the button or loose any information he has already typed within the textbox/s.  If it is, can anyone give a simple script that I can look into.

 

Much thanks for any help.

Link to comment
https://forums.phpfreaks.com/topic/57674-create-textbox/
Share on other sites

Piece of cake try this

<script>
function addField(){
var textfield='<input type="text" />';

document.getElementById('dynamic_fields').innerHTML+=textfield;
}
</script>
<div id="dynamic_fields"></div><a href="javascript:addField()">add field</a>

Link to comment
https://forums.phpfreaks.com/topic/57674-create-textbox/#findComment-285627
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.