Password/Confirm password with jquery

Utilises jQuery's keyup event to trigger a match between both fields after every keystroke.

by aelor

HTML

<label>password :
    <input name="password" id="password" type="password" />
</label>
<br>
<label>confirm password:
    <input type="password" name="confirm_password" id="confirm_password" /> <span id='message'></span>

JavaScript

$('#password, #confirm_password').on('keyup', function () {
    if ($('#password').val() == $('#confirm_password').val()) {
        $('#message').html('Matching').css('color', 'green');
    } else 
        $('#message').html('Not Matching').css('color', 'red');
});