Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<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
You can’t perform that action at this time.