如何触发HTML Select onClick事件(使用选项激活选择下拉列表) [英] How to trigger the HTML Select onClick event (activates select dropdown with options)

查看:1049
本文介绍了如何触发HTML Select onClick事件(使用选项激活选择下拉列表)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何触发任何 select (html combobox element)的 onClick 事件。 p>

我试图做 $('#MySelect')。click(); 使用 jQuery 并尝试 document.getElementById('MySelect')。click(); 使用纯JavaScript。



但是这两个不会触发具有选择选项的下拉式事件。



Ps:我确定选择器 $('#MySelect')存在。

解决方案

这不是一个微不足道的问题。



http: //code.google.com/p/expandselect/


I want to know how to trigger the onClick event of any select(html combobox element).

I tried to do $('#MySelect').click(); using jQuery and tried document.getElementById('MySelect').click(); using pure javascript.

But the two don't fire the dropdown event that have the options of the select.

Ps: i have sure that selector $('#MySelect') exists.

解决方案

This guy did it. It is not a trivial problem.

http://code.google.com/p/expandselect/

这篇关于如何触发HTML Select onClick事件(使用选项激活选择下拉列表)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆