JSFiddle - React, Tailwind, and code Playground
HTML
<script type="text/javascript">
function IsValidZipCode(event) {
event.preventDefault();
var zip = document.getElementById('txtZip').value;
var ZipArray = ["60543", "60188"];
var isValid = ZipArray.indexOf(zip);
if (isValid >= 0){
event.preventDefault;
alert ('Nice! go ahead and book!')
window.location.href = 'yoururl.com'
}
else {
alert('Sorry, we do not offer delivery here at this time');
return false;
}
}
</script>
<form>
Please Enter Zip Code: <input id="txtZip" name="zip" type="number" />
<input onclick="IsValidZipCode(event)" id="Button" type="submit" value="Submit"/>
</form>