/    Sign up×
Community /Pin to ProfileBookmark

hi to all,
Actually i am newbie to javascript and i have to use it in my project.So the problem is that i have a form having one textbox and one button.
when i click on the button another textbox should be created automatically.
Can anyone help me by providing the code for it.
Thanks in advance.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceJun 15.2006 — There's no substitute for making the time to take a complete [URL=http://www.webreference.com/programming/javascript/diaries/]JavaScript Tutorial[/URL] and, thereby, improve your own coding abilities. As for the DOM part of the question:

var fld = document.createElement("INPUT");

fld.type = "text";

fld.name = "myTextBoxName";

fld.size = 20;

fld.value = "[initial value]";

[I]buttonObject[/I].parentNode.insertBefore(fld, [I]buttonObject[/I]); // depends where you want it
×

Success!

Help @sujit_rajput spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...