How to check whether all radio buttons have been been selected
Hi,
First post...here goes.
I have a form that will dynamically place a number of radio button groups on the page.
I don't want the user to be able to submit the form until a value has been chosen for ALL fields.
I have hidden the submit button with the though of showing it again once ALL fields have been checked.
My code so far...
-
- $(document).ready(function () {
- //Hide the submit button
- $('#MainContent_sbmtButton').hide();
- //Change background of question to show clearly which questions have been answered
- $('.buttonbox').click(function () {
- $(this).parent("tr").find("td.question").addClass('rated');
- $(this).parent("tr").find("td.question").removeClass('question');
- // If all questions have been answered, show the submit button
- if ($('input:radio').is(':checked')) {
- $('#MainContent_sbmtButton').show();
- }
- });
- });
This doesn't work as expected. It shows the submit button when any of the radio buttons are clicked.
I knows this si probably really simple, but I just can't figure it out.
TIA
Tom