validating radio buttons
Closed this issue · 1 comments
sesrikanth commented
Initially none of the radio buttons in a from are selected. Though we can pre-select a default radio button, this helps in forcing user to consciously select proper option.
Now how do i check if one of the radio buttons is selected, through validity methods ? If not possible, then i can use jQuery("input:radio").is(":checked"). In that case, I do not know to stop the form from getting submitted.
sesrikanth commented
Hi, found out the solution. assert can be used to check for this. hope this may help some one.
jQuery("input:radio").assert(jQuery("input:radio[name='icecreams']").is(":checked"), "Please select your favorite icecream !");