Jump to content

<select> tag


watagal

Recommended Posts

Greetings-I have a <select name="abc" "onclick='java script:sample()'"> group. I can get the javascript to execute when anything is clicked in the listbox, But i need to further refine the javascript depending on which option is selected (clicked) in the listbox.How can I do this in HTML or in the javascript? This happens prior to hitting the 'submit' form button.TiA, Gal

Link to comment
Share on other sites

try thisHTML

<select name="abc" onchange="sample(this)">...</select>

JavaScript

function sample(select) {  if(select.options[select.selectedIndex].value == "something") {	//do someting  }  else {	//do something else  }}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...