Good day.
The question is quite noobish, but I ask for help, since JS has just started to learn, and jQuery has not yet penetrated at all.
There is a page with ready validation of inputs (radio) on whether they are selected or not. If no answer is selected, the default button is disabled and the text Please, give answers to all questions . If selected, move on.
But validation works generally on the page.
It is necessary to alter it somehow, so that when you click on the submit button, validation check starts. If everything is ok, we’ll start action="http://google.com" , if not, we span.warning-text show a message from span.warning-text . Well, no disabled on the button to use already.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <!-- RADIO SELECTION VALIDATION SCRIPT--> <script type="text/javascript"> var a01 = $('input[name=answer-1]'); var a02 = $('input[name=answer-2]'); var a03 = $('input[name=answer-3]'); var a04 = $('input[name=answer-4]'); var a05 = $('input[name=answer-5]'); validate(); $("input[type='radio']").change(validate); function validate() { if ($(a01).is(':checked') && $(a02).is(':checked') && $(a03).is(':checked')&& $(a04).is(':checked')&& $(a05).is(':checked')) { $(".btn#submit").removeAttr("disabled", false); $(".warning-result-text").css("opacity", '0'); } else { $(".btn#submit").attr("disabled", true); } } </script> <form class="get-result-form" action="http://google.com"> <span class="warning-text">Please, give answers to all questions</span> <input class="btn btn-submit" id="submit" type="submit" value="Submit answers" disabled="true"> </form>