admin 管理员组文章数量: 1086019
I have a dropdown list. I am using onchange
event of this dropdown to show some text in a textbox below.
Its perfectly fine, but I want to to do something like this:---
If user click on the drop down then the whole list will be populated. right.. Now if he is trying to choose the value from the list using up/down arrow button of the key board I want to fire the event at that time. How can I do this?
Onchange
is not working for this purpose.
I have a dropdown list. I am using onchange
event of this dropdown to show some text in a textbox below.
Its perfectly fine, but I want to to do something like this:---
If user click on the drop down then the whole list will be populated. right.. Now if he is trying to choose the value from the list using up/down arrow button of the key board I want to fire the event at that time. How can I do this?
Onchange
is not working for this purpose.
2 Answers
Reset to default 4You can do something like this:
<script type="text/javascript">
function change(value){
alert("key pressed "+value)
}
</script>
<select name="k" onkeypress="change(this.value)">
<option value="acb">ABC</option>
<option value="def">DEF</option>
</select>
You have the onkeydown event. MSDN
In your case, onchange will be raised when the select list loses the focus.
本文标签: javascriptOnchange event of DropdownlistStack Overflow
版权声明:本文标题:javascript - Onchange event of Dropdownlist - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744058459a2526280.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论