Skip to content

Instantly share code, notes, and snippets.

@Bijesse
Forked from anonymous/index.html
Last active August 29, 2015 14:27
Show Gist options
  • Save Bijesse/c9b4788ab1fb6e21ecff to your computer and use it in GitHub Desktop.
Save Bijesse/c9b4788ab1fb6e21ecff to your computer and use it in GitHub Desktop.
Enter Your Credentials (simple) // source http://jsbin.com/japixi
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<meta charset="utf-8">
<title>Enter Your Credentials (simple)</title>
</head>
<body>
<div class="input-group">
<!-- Change type to password -->
<input type="text" id="txtPass"
class="form-control" placeholder="Enter Password" />
<span class="input-group-btn">
<button class="btn btn-default" id="btnSubmit">Verify</button>
</span>
</div>
<script id="jsbin-javascript">
// Set Password
var myPassword="password";
// Set 2 variables: one to track attempts and the other to track max amount of tries
var btnSubmit = document.getElementById("btnSubmit");
btnSubmit.addEventListener("click", function(){
var txtPass = document.getElementById("txtPass").value;
// Create a function
// that checks the passwords
// returns a boolean
if (txtPass === myPassword) {
alert("Welcome! To ....");
} else {
alert("Not the Password!");
return;
}
// Bonus: use an incrementor to track the amount of attempts made
});
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery.min.js"><\/script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"><\/script>
<meta charset="utf-8">
<title>Enter Your Credentials (simple)</title>
</head>
<body>
<div class="input-group">
<\!-- Change type to password -->
<input type="text" id="txtPass"
class="form-control" placeholder="Enter Password" />
<span class="input-group-btn">
<button class="btn btn-default" id="btnSubmit">Verify</button>
</span>
</div>
</body>
</html></script>
<script id="jsbin-source-javascript" type="text/javascript">// Set Password
var myPassword="password";
// Set 2 variables: one to track attempts and the other to track max amount of tries
var btnSubmit = document.getElementById("btnSubmit");
btnSubmit.addEventListener("click", function(){
var txtPass = document.getElementById("txtPass").value;
// Create a function
// that checks the passwords
// returns a boolean
if (txtPass === myPassword) {
alert("Welcome! To ....");
} else {
alert("Not the Password!");
return;
}
// Bonus: use an incrementor to track the amount of attempts made
});
</script></body>
</html>
// Set Password
var myPassword="password";
// Set 2 variables: one to track attempts and the other to track max amount of tries
var btnSubmit = document.getElementById("btnSubmit");
btnSubmit.addEventListener("click", function(){
var txtPass = document.getElementById("txtPass").value;
// Create a function
// that checks the passwords
// returns a boolean
if (txtPass === myPassword) {
alert("Welcome! To ....");
} else {
alert("Not the Password!");
return;
}
// Bonus: use an incrementor to track the amount of attempts made
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment