admin管理员组文章数量:1289421
i am trying to get the value of the selected index in my javascript
here i am defining my list box
<select name="bo" id="bo" OnBlur="retrieveData(this.form)" ></select>
here i am trying to get the value (inside the form)
alert(formbo.value); // NOT working
alert(formbo.selectedIndex) // working
alert(formbo.selectedIndex.value) // NOT working
but its showing "undefined"
i am trying to get the value of the selected index in my javascript
here i am defining my list box
<select name="bo" id="bo" OnBlur="retrieveData(this.form)" ></select>
here i am trying to get the value (inside the form)
alert(form.bo.value); // NOT working
alert(form.bo.selectedIndex) // working
alert(form.bo.selectedIndex.value) // NOT working
but its showing "undefined"
Share Improve this question asked Nov 11, 2011 at 19:15 junaidpjunaidp 11.2k30 gold badges90 silver badges144 bronze badges 1-
Show your
retrieveData
function. – Rob W Commented Nov 11, 2011 at 19:16
2 Answers
Reset to default 5form.bo.options[form.bo.selectedIndex].value;
try this: in your html:
<select name="bo" id="bo" OnBlur="getComboVal(this)" ></select>
in javascript:
function getComboVal(sel)
{
alert (sel.options[sel.selectedIndex].value);
}
本文标签: get value of selected index of combo box in javascriptStack Overflow
版权声明:本文标题:get value of selected index of combo box in javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741407464a2377032.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论