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

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -