remove checkbox value onload

remove checkbox value onload

Hello and thank you to all who have helped me previously.
Here's my predicament.  

I am using ExpressionEngine and Solspace's Freeform Pro.  I have my form set up so that the user fills in the information and then clicks the submit button, which is labelled "Continue" which then takes them to a page where they can review and edit the date they just filled in.  Basically this is the same form but the user has the ability to edit their information and then click the submit button.

Here's where I'm failing.  On this edit form, I have added one checkbox field that needs to be required,  therefore checked, before the form gets submitted.  If this checkbox is not checked, then the form should not submit.

The problem is that for this type of field, a single checkbox, Freeform Pro automatically gives this field a value (n).  So what I would like to do is, after the initial form is submitted and while this edit form loads, use jquery to remove this value and make the field required.  The code I have used below has not worked.  

  1. $(function(){ 
  2. var valChk = $('input:checkbox[name=yes_1]').val()
  3. if(valChk == 'n') {
  4. $("#iAgree").prop( "checked", false );
  5. $("#iAgree").addClass("required error");
  6. }
  7. }); 

If anyone could let me know if I'm on the right track, I would greatly appreciate it.

Thanks 

Peter T