I have a form with a checkbox, and I want it to be validated after the form is submitted, when it returns to the same view with an error. I heard that the value attribute can help me set the checkbox, so I'm trying to set it to true / false. In any case, the input value remains "false" even if I click on it. What exactly is going on? I thought the value would be true / false after clicking on the checkbox
<input type="checkbox" name="acceptRules" class="inline checkbox" id="checkbox1" value="false"> <script> $("#checkbox1").is(':checked', function(){ $("#checkbox1").attr('value', 'true'); }); </script>
source share