Forum Discussion
DougHenning1
2 years agoCommunity Manager
Hi Lija,
Update the field on the form to include the id and remove the onChange attribute:
Instead of the CheckForZip function, you can add an event listener to the field:
------------------------------
Doug Henning
------------------------------
Update the field on the form to include the id and remove the onChange attribute:
<tr>
<td style="font-family: Sans-serif;" class="m">Zip Code:*</td>
<td class="m"><input type="text" size="60" id="_fid_16" name="_fid_16"/></td>
</tr>
Instead of the CheckForZip function, you can add an event listener to the field:
<script language="javascript">
var fid16 = document.getElementById('_fid_16');
fid16.addEventListener('change', (event) => {
var zipcode = ["94602", "95616"]
if (zipcode.includes(event.target.value)) {
alert('yes');
}
});
</script>
Hope that helps!
------------------------------
Doug Henning
------------------------------