samedi 25 janvier 2020

jQuery Greater than and Smaller than check

This is my form:

<form class="fms-quote-form" action="https://web.com/quotes" method="get">
<input name="wpf126904_18" id="fms-zip" type="number" placeholder="Enter your Zipcode">
<input type="submit" value="Get My Rates">
</form>

And this my jQuery that's not working:

$('.fms-quote-form').submit(function() {

if ( $('#fms-zip').val() >= 90000 AND <=96162 ) {
  return true;
} else {
    window.open('https://smartfinancial.com/auto-insurance-rates', '_blank');
    return false;
  }
});

How do I (i) check that the value of #fms-zip is greater than 90000 and smaller than 96162 to submit the form, and (ii) redirect the user to another website if any other value is entered?

Look forward to your input :)

Aucun commentaire:

Enregistrer un commentaire