Fetch select list value in javascript
I have the select list in the html page as follows:
<select onchange="storePolishType('/p/','b',this.value );" class="drop_down1">
<option value="12">Margin2–Sawed Margin </option>
<option value="13">Polished-Sawed Back Polished </option>
<option value="13">Polished-Steeled Back Polished </option>
<option value="13">Polished–All Polished </option>
<option selected="selected" value="11">Sawed-All Polished </option>
</select>
I want to pass value e.g. 11 and value between option tag e.g. "Sawed-All Polishe开发者_开发技巧d" to the storePolishType javascript function. I don't know how to pass this two values. please help me.
Basically, what you want is:
<select onchange="storePolishType(this.value,this.options[this.selectedIndex].text)" class="drop_down1">
this will pas the value (eg, 11) and the text (eg, "Sawed-All Polished ") to a function storePolishType
live example: http://jsfiddle.net/QFtPG/
精彩评论