Your Free Gift

Your Free Gift

Your free gift | heading logo image.

Your FREE gift is waiting for you, fill out some details below and we will send it your way!

Lost? Click here and we will take you home!

jQuery(document).ready(function(){
//The DOM is ready
jQuery(“#btn_claim”).mouseenter(function(){
//When the submit button is hovered over, we will check if all required fields satisfy requirements, if not display error cursor.
if(jQuery(‘#tb_fName’).val() == ” || jQuery(‘#tb_surname’).val() == ” || jQuery(‘#tb_email’).val() == ”)
{
//Empty field(s)
jQuery(“#btn_claim”).css(‘cursor’, ‘not-allowed’);

//Add borders to empty fields
if (jQuery(‘#tb_fName’).val() == ”)
{
//First name field is one of the issues, add border
jQuery(‘#tb_fName’).css(“border”, “1px solid red”);
}

if (jQuery(‘#tb_surname’).val() == ”)
{
//First name field is one of the issues, add border
jQuery(‘#tb_surname’).css(“border”, “1px solid red”);
}

if (jQuery(‘#tb_email’).val() == ”)
{
//First name field is one of the issues, add border
jQuery(‘#tb_email’).css(“border”, “1px solid red”);
}
//End adding borders to empty fields
return;
}
else
{
//Everything is good show normal pointer, clear to proceed with further validation.
jQuery(“#btn_claim”).css(‘cursor’, ‘pointer’);

//Add onClickListener to do further validation
jQuery(‘#btn_claim’).click(function(){
//Button clicked, check validation then run ajax

if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(jQuery(‘#tb_email’).val()))
{
//Valid email continue.
submitForm();
}
else if (!jQuery(‘#tb_fName’).val() == ” || !jQuery(‘#tb_surname’).val() == ” || !jQuery(‘#tb_email’).val() == ”)
{
//Invalid email, show message.
alert(“Please enter a valid email address.”);
return;
}
});
}

function submitForm()
{
//Everything is good, submit the form.
//Make form disappear
jQuery(‘#form’).fadeOut();
}
});

jQuery(‘#btn_claim’).mouseleave(function(){
setTimeout(function(){
jQuery(‘#tb_fName’).css(“border”, “”);
jQuery(‘#tb_surname’).css(“border”, “”);
jQuery(‘#tb_email’).css(“border”, “”);
}, 500);
});
});

overflow: hidden;