[英]Jquery toggle switch on/off state with Wordpress
I'm currently trying to get the state "on" or "off" from this jquery plugin https://github.com/timmywil/jquery.onoff working on my Wordpress but without any success. 我目前正在尝试从此jquery插件https://github.com/timmywil/jquery.onoff使状态为“ on”或“ off”,但我的Wordpress却没有成功。
I would like tu use it to make some conditions for toggle on/off filters, here the link of my wordpress http://www.capitainebar.com/recherche/ 我想用它来为打开/关闭过滤器创造一些条件,这里是我的wordpress的链接http://www.capitainebar.com/recherche/
you can just get the status of the checkbox like you would with a normal checkbox: 您可以像使用普通复选框一样获取复选框的状态:
$('#onoffswitch1').val();
would be the solution in your wordpress link. 将是您的WordPress链接的解决方案。
If you want to do an action if it the value is checked or not: 如果要执行某项操作(如果已检查,则不检查该值):
if ($('#onoffswitch1').is(":checked")){
// it is checked
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.