TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Javascrip-Add new textbox at runtime in your DIV tag
Ghanashyam Nayak
Apr 29, 2020
10
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
Using javascript function it will add new textboxes on button's click event into your page.
<html>
<head>
<title>Dynamic Form</title>
<script type=
"text/javascript"
>
function
NewTextbox()
{
var
t = 1;
newTextbox.innerHTML = newTextbox.innerHTML +
"<input type=text name='txt'+ t />"
}
</script>
</head>
<body bgcolor=#00ff00 alink=blue vlink=blue>
<form name=
"form"
action=
"post"
method=
""
>
<input type=
"button"
value=
"Add New TextBox"
onClick=
"NewTextbox()"
>
<div id=
"newTextbox"
></div>
</form>
</body>
</html>
Javascrip-Add new textbox at runtime in your DIV tag
Next Recommended Reading
Hide and Show DIV using JavaScript