[英]jquery slide toggle as a form checkbox
How would I go about using something like this Jquery Slide toggle as a checkbox in a form? 我如何使用像这样的Jquery Slide切换作为表单中的复选框?
Thanks so much in advance. 非常感谢提前。 :)
:)
You could map it to a hidden form element that contains a boolean value, and update that value when the slider is toggled. 您可以将其映射到包含布尔值的隐藏表单元素,并在切换滑块时更新该值。
Here you go, this example show the checkbox: http://jsfiddle.net/skimberk1/TUPG7/ 在这里,这个例子显示了复选框: http : //jsfiddle.net/skimberk1/TUPG7/
And in this example, it's hidden: http://jsfiddle.net/skimberk1/KNHu7/ 在这个例子中,它是隐藏的: http : //jsfiddle.net/skimberk1/KNHu7/
The way it works is that it detects if theres a checkbox directly after the toggle, and if there is, it hides it and checks/unchecks it when you slide the toggle. 它的工作方式是它检测切换后是否有一个复选框,如果存在,它会隐藏它并在滑动切换时检查/取消选中它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.