Last active
March 17, 2020 14:37
-
-
Save CiaranR/fc090388cdfc79fbef135c572fc8f428 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toSubmit() { return !1 } | |
$('#sbmt-btn').click(function (e) { | |
e.preventDefault(); | |
let valid = true; | |
if ($('#uni-last-name').val() == '' && $('#ln-error').val() == undefined) { | |
valid = false; | |
$("<p class='tml-error' id='ln-error'>Last Name field is required</p>").insertAfter("#uni-last-name"); | |
} | |
if ($('#uni-first-name').val() == '' && $('#fn-error').val() == undefined) { | |
valid = false; | |
$("<p class='tml-error' id='fn-error'>First Name field is required</p>").insertAfter("#uni-first-name"); | |
} | |
if ($('#uni-school option:checked').val() == '' && $('#un-error').val() == undefined) { | |
valid = false; | |
$("<p class='tml-error' id='un-error'>University Name field is required</p>").insertAfter("#uni-school"); | |
} | |
if ($('#uni-email').val() == '' && $('#em1-error').val() == undefined) { | |
valid = false; | |
$("<p class='tml-error' id='em1-error'>Email field is required</p>").insertAfter("#uni-email-domain"); | |
} | |
if ($('#uni-email').val().match(/[!@#$%^&*(),.?":{}|<>]/) && $('#em2-error').val() == undefined) { | |
valid = false; | |
$("<p class='tml-error' id='em2-error'>Email field shouldn`t consist speacial characters</p>").insertAfter("#uni-email-domain"); | |
} | |
if (valid === true) { | |
Cookies.set('uni_name', $('#uni-school option:checked').text()); | |
$("#uni-form").submit(); | |
} | |
}); | |
$("#uni-form").submit(function (n) { | |
n.preventDefault(); | |
Cookies.set("uni-cookie", $("#uni-email").val() + "@" + $("#uni-school").val()), Cookies.set("uni-first-name", $("#uni-first-name").val()), Cookies.set("uni-last-name", $("#uni-last-name").val()), console.log($("#uni-first-name").val()), console.log($("#uni-last-name").val()), console.log($("#uni-email").val() + "@" + $("#uni-school").val()), $(location).attr('href', "https://financeunlocked.com/membership/university-extended-trial-subscription/") | |
}), $("#uni-school").change(function (n) { | |
$("#uni-email-domain").html("@" + $("#uni-school").val()) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment