Created
April 14, 2019 20:25
-
-
Save khatfield/9e923f90abf9e42954b5cc02acc37041 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
<script type="text/javascript"> | |
$(function(){ | |
$('#jq-password [type="password"]').keyup(function(){ | |
//Store the field objects into variables ... | |
var password = $('#password3'); | |
var confirm = $('#confirm3'); | |
var message = $('#confirm-message3'); | |
//Set the colors we will be using ... | |
var good_color = "#66cc66"; | |
var bad_color = "#ff6666"; | |
if(password.val() == confirm.val()){ | |
confirm.css('background-color', good_color); | |
message.css('color', good_color).html("Passwords Match!"); | |
} else { | |
confirm.css('background-color', bad_color); | |
message.css('color', bad_color).html("Passwords Do Not Match!"); | |
} | |
}); | |
}); | |
</script> | |
<div class="tutorial-wrapper"> | |
<form id="jq-password"> | |
<div class="field-wrapper"> | |
<label for="password2">Password:</label> | |
<input type="password" name="password" id="password3"> | |
</div> | |
<div class="field-wrapper"> | |
<label for="confirm2">Confirm Password:</label> | |
<input type="password" name="confirm" id="confirm3"> | |
<span id="confirm-message3" class="confirm-message"></span> | |
</div> | |
</form> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment