I am making a form for customers to quickly see if the business services their area. I need the input to validate the input postcode from 3030 to 3340.
If it is true then a pop-up dialog box will appear with confirmation of service and contact triggers. If false then a dialog appears informing the customer that their area is not currently serviced by the business.
I know I haven't created the .poscode-valid or .postcode-invalid yet. I also don't want the selection arrows so a fix that removes them would be good. Thanks for any help.
// // ********************************************************************************
// // This script checks to see if the postcode matched the excepted field and returns
// // a dialog box accordingly
// // ********************************************************************************
// this script need to evaluate the input against input numbers >=3030 && <=3340.
jQuery(document).ready(function($) {
$('.postcode_form').validate({
rules: {
range: [3030, 3340]
}
if (range = true) {
$('.postcode_form').addClass('.postcode_valid')
} else {
$('.postcode_form').addClass('.postcode_invalid')
}
});
body {
margin: 0;
padding: 0;
}
#service_area {
background: #245353;
background-size: cover;
height: 100vh;
}
.service_area_container {
max-width: 800px;
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.area h1 {
text-align: center;
font-size: 2.5em;
text-transform: uppercase;
margin: 0;
}
.area h5 {
margin: 0 2em 2em 2em;
text-align: center;
font-size: 1em;
letter-spacing: 0.0385em;
font-weight: 100;
text-transform: uppercase;
}
.area_input {
width: 184px;
margin: 0 auto;
}
input.your_postcode {
width: 70px;
margin: 0 -6px 0 0;
padding: 14px 17px 12px 17px;
border: none;
letter-spacing: 0.0585em;
z-index: 1;
}
.area_input .submit {
padding: 14px 17px 12px 17px;
text-transform: uppercase;
letter-spacing: 0.0356em;
font-weight: 100;
z-index: 3;
margin: 0;
border: none;
}
<section id="service_area" class="scrolling-bg bg-3">
<div class="service_area_container area">
<h1>Where's the job?</h1>
<h5>Enter your <span class="high_light">postcode</span> below to see if we <span class="high_light">service</span> the <span class="high_light">area</span></h5>
<div class="area_input">
<form class="postcode_form">
<input type="number" id="your_postcode" class="your_postcode" name="postcode" placeholder="Postcode">
<input type="submit" class="submit" value="Submit">
<div class="loading"></div>
</form>
</div>
<!-- .area_input -->
</div>
<!-- .service_area_container -->
</section>
<!-- #service_area -->
You can see the code I have thus far here: http://jsfiddle.net/paralellos/6fr1chqo/