How to get twitter bootstrap toggle switch values using jquery

后端 未结 4 1337
梦毁少年i
梦毁少年i 2021-01-31 17:51

I am using http://bootstrapswitch.site/ for toggle switch buttons. How can I get the toggle switch like \'on\' or \'off\' using jQuery?

My Code is :

<         


        
相关标签:
4条回答
  • 2021-01-31 18:28

    As far as I can tell the method has been updated (but not well documented).

    $('#switcher').bootstrapSwitch('state', true)
    $('#switcher').bootstrapSwitch('state', false)
    
    0 讨论(0)
  • 2021-01-31 18:31
    $('#switcher').bootstrapSwitch('state'); // true || false
    $('#switcher').bootstrapSwitch('toggleState');
    

    Refer this link for more functions

    0 讨论(0)
  • 2021-01-31 18:31

    About changing state in my case,

    ('#switcher').bootstrapSwitch('state', false); 
    

    It's correct code.

    0 讨论(0)
  • 2021-01-31 18:32
    $('#switcher').bootstrapSwitch('state');
    

    Not work for me, but in my version:

    $("#switcher").bootstrapSwitch("status");
    

    can work well.

    0 讨论(0)
提交回复
热议问题