javascript - Toggle class when checkbox is checked with JQuery -


I have a switcher with a bootstrap, I want that when the checkbox (switch) is checked, then Class panel change, from brown to green I did it before but I changed my switcher and it does not work anymore.

The main markup for the switcher is:

  & lt; Label class = "switch good-light" onclic = "" & gt; & Lt; Input type = "checkbox" & gt; & Lt; Period & gt; Wireless & lt; Span & gt; Off of & lt; / Span & gt; & Lt; Period & gt; On & lt; / Span & gt; & Lt; / Span & gt; & Lt; A class = "BTN BTN-Primary" & gt; & Lt; / A & gt; & Lt; / Labels & gt;   

And the toggle class of JQuery is:

  $ (document) .ready (function () {$ ('. Switch-light') ( "Panel", "off", this.checked) .toggleClass ("Panel-Success",! This.checked);}). Change ()});   

This is my JSField:

  try it out Code: $ (document) .ready (function () {$ ('switch-light'). Bootstrap switch (); $ ('panel-body input'). ('Change', function () {$ (This is) .Prints ('panel-body'). Former () Parents ('panel') Toggle class ("panel-off 2", this check) Toggle class (" Success ", this.checked);})}); In addition you can find it here: http://jsfiddle.net/CYLcY/27/    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -