jQuery radio button if statement -


How can I make a simple statement based on the radio button selection?

So if the radio button is displayed inches, then div.inchesUser is shown (using .show) and vice versa for centimeters.

This is what I have to do:

  $ ('. Div.inchesUser') show (200);  

This is my radio button code:

  & lt; Form id = "unitChooser" & gt; & Lt; Label & gt; Inch or centimeter? & Lt; / Label & gt; & Lt; Input class = "unitSelectInches" type = "radio" name = "units" value = "inch" /> Inch & lt; Input class = "select unit" "check" = "check" type = "radio" name = "units" value = "cm" /> Centimeter & lt; / Form & gt;  

Try it

  $ ("Input : Radio (name = units) ". (Function () {var value = $ (this) .val (); if (value == 'inch') $ ('div.centimetreUser'). Show (200) ;});  


Comments

Popular posts from this blog

eclipse plugin - Run java code error: Workspace is closed -

ios - How do I use CFArrayRef in Swift? -

scala - Play Framework - how to bind form to a session field -