$(function(){ var passCheck = false; $("#user_password").focusout(function(){ $(".passerror").empty(); var pass = $("#user_password").val(); if(pass.length < 6){ $(".passerror").append('Password must be more than 6 characters'); } }); $("#user_password_2").focusout(function(){ $(".passerror").empty(); var pass = $("#user_password").val(); var verify = $('#user_password_2').val(); if(pass.length >= 6 && pass == verify){ $("#passwordMatch").fadeIn(500); passCheck = true; userTimeout(function(){ $("#passwordMatch").fadeOut(500); }, 3000); }else if(pass.length < 6){ $(".passerror").append('Password must be more than 6 characters'); }else{ $(".passerror").append('Password does NOT match'); } }); $("#country").change(function(){ var country = $(this).val(); if(country == 182){ $(this).parent('div').css("width", "50%"); $(this).parent('div').next().fadeIn(100); $("#state").html('') }else if(country == 31){ $(this).parent('div').css("width", "50%"); $(this).parent('div').next().fadeIn(100); $("#state").html('') }else if(country != 1 || country != 2){ $(this).parent('div').next().fadeOut(0); $(this).parent('div').css("width", "100%"); } }); $("#trialForm").submit(function(){ var agree = $("#agreeCheckBox") if(passCheck != true){ alert("password id Not correct"); return false; }else{ return true; } if(!agree.is(':checked')){ alert("You have to agree to the terms in order to continue"); return false; }else{ return true; } }); });