De-jquery the javascript
This commit is contained in:
parent
836a71b2d0
commit
867c19f97c
3 changed files with 22 additions and 23 deletions
|
@ -1,22 +1,16 @@
|
|||
{{template "header.html" .S}}
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#passCheck").keyup(checkPasswordMatch);
|
||||
});
|
||||
|
||||
function checkPasswordMatch() {
|
||||
var password = $("#pass").val();
|
||||
var confirmPassword = $("#confirmPass").val();
|
||||
var password = document.forms["createAccount"]["pass"].value;
|
||||
var confirmPassword = document.forms["createAccount"]["confirmPass"].value;
|
||||
|
||||
if (password != confirmPassword) {
|
||||
$("#passCheck").removeClass("success");
|
||||
$("#passCheck").addClass("error");
|
||||
$("#passCheckHelp").html("Passwords don't match!");
|
||||
document.getElementById("confirmPass").classList.remove("is-valid");
|
||||
document.getElementById("confirmPass").classList.add("is-invalid");
|
||||
} else {
|
||||
$("#passCheck").removeClass("error");
|
||||
$("#passCheck").addClass("success");
|
||||
$("#passCheckHelp").html("");
|
||||
document.getElementById("confirmPass").classList.remove("is-invalid");
|
||||
document.getElementById("confirmPass").classList.add("is-valid");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -54,7 +48,7 @@ function checkPasswordMatch() {
|
|||
</div>
|
||||
<div class="col-sm-4">
|
||||
<h3>Create an Account</h3>
|
||||
<form id="login" method="POST" action="/create_user/" enctype="application/x-www-form-urlencoded">
|
||||
<form id="createAccount" method="POST" action="/create_user/" enctype="application/x-www-form-urlencoded">
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="user">
|
||||
<svg class="bi" width="1.5em" height="1.5em" fill="currentColor">
|
||||
|
@ -69,7 +63,7 @@ function checkPasswordMatch() {
|
|||
<use xlink:href="/img/bootstrap-icons.svg#key-fill"/>
|
||||
</svg>
|
||||
</span>
|
||||
<input type="password" class="form-control" placeholder="Password" name="pass" aria-label="Password" aria-describedby="pass" id="pass">
|
||||
<input type="password" class="form-control" placeholder="Password" name="pass" aria-label="Password" aria-describedby="pass" id="pass" onchange="checkPasswordMatch()">
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="pass">
|
||||
|
@ -77,7 +71,8 @@ function checkPasswordMatch() {
|
|||
<use xlink:href="/img/bootstrap-icons.svg#key-fill"/>
|
||||
</svg>
|
||||
</span>
|
||||
<input type="password" class="form-control" placeholder="Confirm password" name="confirmPass" aria-label="Password" aria-describedby="confirmPass" id="confirmPass">
|
||||
<input type="password" class="form-control" placeholder="Confirm password" name="confirmPass" aria-label="Password" aria-describedby="confirmPass" id="confirmPass" onchange="checkPasswordMatch()">
|
||||
<div class="invalid-feedback">Passwords don't match!</div>
|
||||
</div>
|
||||
<input class="btn btn-primary" type="submit" name="submit" value="Create" />
|
||||
</form>
|
||||
|
|
Reference in a new issue