MVC 切换按钮
我现在有一组按钮,用户可以选择它们来过滤网格。问题是,单击其中一个按钮后,用户不知道当前应用的活动过滤器。那么有人可以帮我弄清楚如何让这组按钮充当切换按钮(规范是更改活动按钮的按钮背景颜色)吗?
请注意,这是在 MVC 中,每个按钮都绑定了一个 onclick 事件,该事件调用 javascript 函数。
I have a group of buttons at the moment which users can select to filter out a grid. The problem is that after one of the buttons is clicked, the user does not know the current active filter that was applied. So can anybody help me to figure out how to have these group of buttons act as toggle buttons (spec is to change the button background color for active button)?
Please note this is in MVC and there is an onclick event bound to each of the buttons which calls a javascript function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 jquery UI,您可以尝试使用按钮插件配置为复选框
If you ar using jquery UI you could try using the button plugin configured as a checkbox
您没有详细说明如何连接单击事件,但在按钮的单击处理程序中,您可以执行以下操作:
如果您使用 jQuery 或其他 JS 框架,还有其他方法可以执行此操作。
You haven't given much detail on how you've wired up click events, but in your click handler for the buttons, you could do something like this:
There are other ways to do this if you're using jQuery or another JS framework.