用图像替换复选框并更新 onClick(可能是 jQuery?)
有没有一种方法可以让图像替换复选框,当有人单击它时,它会选择它,并将图像更改为另一个图像,例如“选中”图像?
所以本质上是:
[heart-icon] 健康和健身
用户点击它
[check-icon] 健康和健身
,现在该区域已被选择
Is there a way that I can have an image replace a checkbox, and when someone clicks on it, it selects it, and changes the image to another image like a "checked" image?
So essentially:
[heart-icon] Health and Fitness
user clicks on it
[check-icon] Health and Fitness
and now that area is selected
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
肯定有可用的脚本/插件来执行此操作。我没有使用过其中任何一个,所以我不能具体推荐一个,但这里有一个例子:
http://www.itsalif.info/content/ezmark-jquery-checkbox-radiobutton-plugin
There are definitely scripts/plugins available to do this. I've not used any of them so I can't recommend one specifically, but here's an example:
http://www.itsalif.info/content/ezmark-jquery-checkbox-radiobutton-plugin
我会尝试这个插件:SimpleImageCheck
http://www.jkdesign.org/imagecheck/
自定义复选框的代码看起来很简单:
I would try this plugin: SimpleImageCheck
http://www.jkdesign.org/imagecheck/
Code to customize the checkbox looks simple:
不需要插件,也不需要 JQuery:
No need of plugins nor JQuery: