jquery激活选择框的下拉菜单
如何通过单击 jQuery 中的链接来激活/停用经典选择框的下拉菜单? 我不需要用 jQuery 替换 selectbox,因为它对于大量选项来说太慢了。 我测试了一切,但没有结果。
How can I activate/deactivate dropdown of classic selectbox by clicking to link in jQuery?
I don't need selectbox replacing with jQuery, because it's too slow for huge number of options.
I test everything but without result.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您说您希望
这是你的意思吗?
如果是这样,我认为您将不得不创建自己的选项,但又要寻找其他方法来满足您所需的大量选项。
If you're saying that you want the
<select>
to display its options via javascript, I don't think it can be done cross-browser (or perhaps in any browser).Is this what you meant?
If so, I think you'll be stuck creating your own, but finding some other way to accommodate the large quantity of options you require.
如果您想在单击链接时启用/禁用下拉列表,可以这样做:
其中
link_id
应该是链接的id
,而dropdown_id
应该是选择框的id
。toggle
函数将在第一次单击链接时禁用选择框,并在第二次单击时重新启用它,依此类推。If you mean to enable/disable the dropdown when you click on the link, you could do this way:
Where
link_id
is supposed to be theid
of the link anddropdown_id
is supposed to be theid
of the select box. Thetoggle
function will disable the select box on first click on the link and enable it back on second click and so on.