简体   繁体   English

带有JavaScript的下拉菜单中的复选框

[英]Check box inside drop down menu with javascript

如何在下拉菜单中使用javascript来实现复选框,以便每次您单击菜单来更改情况?

The website you have linked presents a list along this lines: http://jsfiddle.net/XJWkH/ 您链接的网站显示了以下内容的列表: http : //jsfiddle.net/XJWkH/

Of course this is just a raw example but basically this is the way the dropdown list on the site works. 当然,这只是一个原始示例,但基本上,这是该站点上的下拉列表的工作方式。 When you click on a dropdown/submenu element, jQuery adds or removes 'checked' class on that element. 当您单击下拉菜单/子菜单元素时,jQuery会在该元素上添加或删除“选中”类。

jQuery is the easiest path here. jQuery是这里最简单的路径。 I have used this plugin with great success and have rolled my own as well. 我已经非常成功地使用了该插件 ,并且也推出了自己的插件

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM