Option label as var in javascript function

\[code\]<select id="wbox" name="listbox" size="20"onchange="call(this)"><optgroup label="Taxes"><option value="http://stackoverflow.com/questions/13735953/1694" label="DNA-option1"></option><option value="http://stackoverflow.com/questions/13735953/1642">RNA-option2</option>\[/code\]I have a list box that I would like to extract the label of the selected option, and use it in a JavaScript function.\[code\]function call(op) { alert(op.label); alert(op.name); alert(op.value); var x = op.label; }\[/code\]However this always returns as label, undefined. I've tried changing the way the option label is written in the html. This might not be the best way to write the java script function. I absolutely cannot use the option value, it is a unique id and used for something else. Any suggestions on what I am doing wrong or a better way to do this?
 
Back
Top