The following code will not work. I am trying to validate that two numeric text fields to no add up to more than 40. Any pointers on why this code will not work?
<div id="Q152_CRANGE" class="validation-error" style="display:none;">Cannot exceed 40 hours per week</div>
<script>
// Validate two short answer real number questions
$("form").submit(function( event ) {
{
A = $("#Q150_1").toString().val();
B = $("#Q152_1").toString().val();
total = ParseInt(A) + ParseInt(A);
if ( total > 40 )
{
$("#Q152_CRANGE").show();
event.preventDefault();
break;
}
else
{
$("#Q152_CRANGE").hide();
}
}
} ) ;
</script>