I’m using css and javascript to check condition of value of partner Code is null and 01
Step 1: if user check checkbox is PARTNER, value of partnerName '01 - Elite' and value of partnerCode is '01' will send when submit
Step 2: if user uncheck checkbox is PARTNER, value of partnerName is 'NULL' and value of partnerCode is 'NULL' will send when submit
this is my code:
<tr>
<th scope="row">Partner</th>
<td colspan="0" style="margin-top: 4px;">
<input id="parnerNameCheck" name="parnerNameCheck" type="checkbox"/><span>PARTNER</span>
</td>
<td>
<select id="partnerName" name="partnerName" disabled>
<option value="" selected>Choose One</option>
<option>01 - Elite</option>
</select>
</td>
<td>
<input id="partnerCode" name="partnerCode" type="hidden" value="01" />
</td>
</tr>
<script>
$('#parnerNameCheck').click(function() {
console.log('parnerNameCheck checked:' + $("#parnerNameCheck").is(":checked"));
$('#partnerName').prop("disabled", !$(this).prop("checked"));
$('#partnerCode').prop("disabled", !$(this).prop("checked"));
});
</script>
but when i uncheck checkbox is PARTNER, value of partnerCode is 01 still sending when submit.
So how to fix the problem? thank a lot