cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <form>
  <div class="password_match" data-msg="Passwords doesn't match.">
    <p>
      <label>Password: 
        <input type="password" name="pass1" required />
      </label>
    </p>

    <p>
      <label>Repeat password: 
        <input type="password" name="pass2" required />
      </label>
    </p>
  </div>
  <input type="submit" name="test" value="Test it" />
</form>
            
          
!
            
              		/* HTML input password match checker
    *  Wrap the password elements with password_match class.
    *  Contents of data-msg attribute will used by browser on password mismatch.
    *  It is defined that way for i8n reasons (you can change the message while page is generated)
    */
		function comparePassword(event) {
			var pass1, pass2;

			if (event.type == 'change') {
				// this = pass1, el = pass2
				pass1 = $(this);
				pass2 = $(event.data.el);
			} else {
				// this = pass2, el = pass1
				pass2 = $(this);
				pass1 = $(event.data.el);
			}

			if (pass1.val() != pass2.val()) {
				pass2[0].setCustomValidity(event.data.msg);
			} else {
				pass2[0].setCustomValidity('');
			}
		}

		$(".password_match").each(function (i, e) {
			var msg = $(e).data('msg');
			if ($("input[type=password]", e).length == 2) {
				var elem = $("input[type=password]", e);
				$(elem[0]).change({el: elem[1], msg: msg}, comparePassword);
				$(elem[1]).keyup({el: elem[0], msg: msg}, comparePassword);
			}
		});
            
          
!
999px
Loading ..................

Console