Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Javascript only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
Javascript
dynamically add/remove input fields
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
mariodavi
New Member
Join Date:
Feb 2008
Posts:
8
#1
dynamically add/remove input fields
Feb 19 '08, 01:39 PM
How I do so that when selecting an option in the select combo an input text it is added below the same?
Thanks!
gits
Recognized Expert
Moderator
Expert
Join Date:
May 2007
Posts:
5390
#2
Feb 19 '08, 03:27 PM
hi ...
welcome to TSDN,
here is a simple example:
[HTML]<script type="text/javascript">
function set_value(node) {
var t = document.getEle mentById('my_te xt');
t.value = node.value;
}
</script>
<select onchange="set_v alue(this);">
<option value="test1">t est1</option>
<option value="test2">t est2</option>
<option value="test3">t est3</option>
</select>
<input id="my_text" type="text">
[/HTML]
kind regards
Comment
Post
Cancel
mariodavi
New Member
Join Date:
Feb 2008
Posts:
8
#3
Feb 20 '08, 05:50 PM
Thank you for the example, but it was not that! = [
The script is to do with that when selecting in the combo, appear (added dynamicly) an input text to be filled out by the user.
Thank you once again
Comment
Post
Cancel
hsriat
Recognized Expert
Top Contributor
Join Date:
Jan 2008
Posts:
1653
#4
Feb 20 '08, 05:58 PM
Originally posted by
mariodavi
Thank you for the example, but it was not that! = [
The script is to do with that when selecting in the combo, appear (added dynamicly) an input text to be filled out by the user.
Thank you once again
You need to explain your problem.
But as far as I can understand, do these changes to gits' code...
Line 4
t.name = node.value;
t.style.display ='';
Line 14
<input id="my_text" type="text" value="" style="display: none;"></input>
Comment
Post
Cancel
mariodavi
New Member
Join Date:
Feb 2008
Posts:
8
#5
Feb 21 '08, 01:41 PM
Add and Remove HTML elements dynamically
Hello everybody!
How can I do to add dynamically a field input form based on the selection of an option of a select combo?!
For example: If the option 1 be selected add field input 1, if option 2 be selected exclude field input 1 and add field input 2.
Thanks!
Comment
Post
Cancel
gits
Recognized Expert
Moderator
Expert
Join Date:
May 2007
Posts:
5390
#6
Feb 21 '08, 03:59 PM
threads merged ... please don't double post your questions ...
kind regards
MODERATOR
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment