Skip to content

Instantly share code, notes, and snippets.

Created April 14, 2019 20:25
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save khatfield/9e923f90abf9e42954b5cc02acc37041 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
$('#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!");
<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 class="field-wrapper">
<label for="confirm2">Confirm Password:</label>
<input type="password" name="confirm" id="confirm3">
<span id="confirm-message3" class="confirm-message"></span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment