how to display in new text field when i add option from drop down list?
how to display in new text field when i add option from drop down list?
Collapse
X
-
Tags: None
-
-
I'm not quite sure I understand what you're meaning, but I'll take a stab at it.
If you have:
You could simply add an 'onchange' javascript function to the element.Code:<select name="selectBox"> <option>1</option> <option>2</otpion> </select>
The the <head> of your page you could put:Code:<select name="selectBox" onchange="myFunction();"> <option>1</option> <option>2</otpion> </select>
So what's happening is that you set a javascript function do something to an element with the id of 'textfield'. What you told it to do is change the html (text) of that element.Code:<script type="text/javascript"> myFunction(){ document.getElementById('textfield').html = "New text!"; } </script>
When you make a selection with your SELECT element, the 'onchange' event is fired and does your javascript function.
I hope this is clear enough.Comment
Comment