Jquery Returning Incorrect Value Of Checked Radio Button When Using Styled Buttons
I'm using the jQuery plugin ScrewDefaultButtons to style my radio buttons, but it seems it comes with a side effect that it doesn't return the correct value when getting it via jQu
Solution 1:
The problem is that ScrewDefaultButtons
wraps the input
elements in a div
and then hides the input
element.
This div has a click event that checks the correct hidden input
element.
However. Since you have an onClick
event YOUR event is run before the change.
That is why you get the old
value.
To solve this add the following code after the call to screwDefaultButtons
:
$('.styledRadio').on('click', updateRegForm);
or
$('.pretty_rb').on('click', updateRegForm);
Remember to remove the onlick attribute from the HTML.
Post a Comment for "Jquery Returning Incorrect Value Of Checked Radio Button When Using Styled Buttons"