Results 1 to 2 of 2
Jun 19, 2007, 03:39 #1
- Join Date
- Oct 2005
- 0 Post(s)
- 0 Thread(s)
Could JS get the value of the selected <option>
I have a <select> list in an html form with many <option>'s. How can I use JS to do different things with an onclick event based on the selected option from the <select> list (before the form is sent).
For examle, suppose there is a link after that <select> element and it has an onclick event that does some actions based on the selected option from the list. So if option with value "change_link" is selected the JS would change the href attribute of the current link, if option with value "change_title" is selected the JS would change the title attribute of the current link...
The question now is: if the form has name "form1" and the <select> element has name "list1", how can I make the JS code recognize the current selected option (its value) from the <select> list?