Separate javascript from html file

This commit is contained in:
Jack 2019-01-13 17:48:06 -08:00
parent 75a581386e
commit c2194a4c0a
2 changed files with 13 additions and 14 deletions

View file

@ -18,18 +18,5 @@
<a class="nav-link" href="index.html">Return to main menu</a>
</form>
</body>
<script type = "text/JavaScript">
var password = document.getElementById("password");
var confirm_password = document.getElementById("confirmPassword");
function validatePassword(){
if(password.value != confirm_password.value) {
confirm_password.setCustomValidity("Passwords Don't Match");
}
else {
confirm_password.setCustomValidity('');
}
}
password.onchange = validatePassword;
confirm_password.onkeyup = validatePassword;
</script>
<script type = "text/JavaScript" src="signupPage.js"></script>
</html>

View file

@ -0,0 +1,12 @@
var password = document.getElementById("password");
var confirm_password = document.getElementById("confirmPassword");
function validatePassword(){
if(password.value != confirm_password.value) {
confirm_password.setCustomValidity("Passwords Don't Match");
}
else {
confirm_password.setCustomValidity('');
}
}
password.onchange = validatePassword;
confirm_password.onkeyup = validatePassword;