I have a dropdown list like this:(我有一个像这样的下拉列表:)
<select id="box1">
<option value="98">dog</option>
<option value="7122">cat</option>
<option value="142">bird</option>
</select>
How can I get the actual option text rather than the value using JavaScript?(如何使用JavaScript获取实际的选项文本而不是值?) I can get the value with something like:(我可以通过以下方式获得价值:)
<select id="box1" onChange="myNewFunction(this.selectedIndex);" >
But rather than 7122
I want cat
.(但是我要的不是7122
而是cat
。)
ask by techtheatre translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…