简体   繁体   中英

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.

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/

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.

If you want to do an action if it the value is checked or not:

if ($('#onoffswitch1').is(":checked")){
  // it is checked
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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