javascript - Radio buttons enable/change CSS on submit button -


While making changes between the two radio buttons, I am trying to change the CSS class of the submit button The example is not getting, and hopefully someone can help me ...

This is my form;

  & lt; Form class = "orderform" & gt; & Lt; Input type = "radio" name = "likes" id = "out" value = "140" checked & gt; & Lt; Label for = "out" & gt; Give me a & lt; / Label & gt; & Lt; Input type = "radio" name = "likes" id = "in" value = "40" & gt; & Lt; Label for = "in" & gt; Let me know B & lt; / Label & gt; & Lt; Input type = "submit" value = "save changes" class = "submit-btn-disable" disable = "disabled" & gt; & Lt; / Form & gt; (Default = "submit-btn-disabled" "mouseover" event:  
  input type = "submit" value = "save changes" class = "submit-btn" & gt; ;  

CSS class here;

  input.submit-btn-disabled {-webkit-box-shadow: none; -WebKit-box-shadow: None; Box-shadow: none; -WebKit-appearance: textfield; -WebKit-box-size: content-box; -Vibit-boundary-radius: 0 AM; -mobile-radius: 0em; boundary-radius : 0m; range: none; background color: # c4daaa; pay Ding: 0.8m; font-size: 0.8m; color: #fff; cursor: indicator; margin-top: 1am;} Input.submit-btn {-webkit-box-shadow: none; -WebKit-box-shadow : None; Box-shadow: none; -webkit-presence: textfield; -webkit-box-shape: content-box; -viith-border-radius: 0m; -move-border-radius: 0em; border- Radius: 0m; Border: None; Background Color: # 3A7B30; Padding: 0.8M Font Size: 0.8 AM Color: #fff; Cursor: Indicator; Margin-Top: 1 AM;} Input .submit-btn: hover {background-color: # 82bc00; }  

This should do the trick -

You will be able to toggle class Function and CSS changes -

JS

  $ ("[name = choice]"). Click (function () {$ ('. Submit-btn') ToggleClass ('active');});  

css

  input.submit-btn.active {background-color: # 82bc00;}  

such Rather than changing the category of Submitted-BTN and Submitted-BTN-Handicapped, you can add or remove active squares and give you the behavior you want.


Comments