Created
March 30, 2022 07:47
-
-
Save paulwababu/600fa1bdef629f3c8207c492dfd64248 to your computer and use it in GitHub Desktop.
javascript testing get element by id code correction
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<!-- Required meta tags --> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<script> | |
//function to validate password. For prototyping purposes | |
function validate() { | |
//read values from inout in sign in page | |
var user = document.getElementById('userName').value; | |
var passcode = document.getElementById('password').value; | |
//check passcode and grant access | |
if(user == 'PaulWababu' && passcode == '443556126216621' || user == 'jess' && passcode == 'jess123'){ | |
alert('Correct credentials'); | |
} else { | |
alert('wrong credentials'); | |
} | |
} | |
</script> | |
<title>Sign in</title> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="d-flex justify-content-center h-100"> | |
<div class="card"> | |
<div class="card-header"> | |
<h3>Sign In</h3> | |
</div> | |
<div class="card-body"> | |
<form> | |
<div class="input-group form-group"> | |
<div class="input-group-prepend"> | |
<span class="input-group-text"><i class="fas fa-user"></i></span> | |
</div> | |
<input type="text" class="form-control" placeholder="username" id="userName"> | |
</div> | |
<div class="input-group form-group"> | |
<div class="input-group-prepend"> | |
<span class="input-group-text"><i class="fas fa-key"></i></span> | |
</div> | |
<input type="password" class="form-control" placeholder="password" id="password"> | |
</div> | |
<div class="row align-items-center remember"> | |
<input type="checkbox">Remember Me | |
</div> | |
<div class="form-group"> | |
<input type="submit" value="Login" class="btn float-right login_btn" onclick="validate()"> | |
</div> | |
</form> | |
</div> | |
<div class="card-footer"> | |
<div class="d-flex justify-content-center links"> | |
Don't have an account?<a href="#">Sign Up</a> | |
</div> | |
<div class="d-flex justify-content-center"> | |
<a href="#">Forgot your password?</a> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<!-- Optional JavaScript --> | |
<!-- jQuery first, then Popper.js, then Bootstrap JS --> | |
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment