Grow your CSS skills. Land your dream job.

Last updated on:

Keep Text Inputs in Sync

var $inputs = $(".example-input");
$inputs.keyup(function() {
      $inputs.val($(this).val());
});

Example



Comments

  1. There seems to be some user unfriendly differences between firefox and chrome (that is that I have noticed)

    in firefox it works fine I think
    but in chrome your marker thing (that blinking line that tells you where in the field you are typing)
    will jump to the end of the field every time you release the key on your keyboard

    this makes it a pain in the ass to edit more than one character thats typed early in the field

  2. Roman Gavrilov
    Permalink to comment#

    doesn’t work when text is pasted using mouse (right click, paste)
    doesn’t work if value is pasted with javascript

    • Permalink to comment#

      For folks using jquery 1.7+

      $inputs.on( "paste keyup", function() { 
           $inputs.val( $( this ).val() );
      });
      
  3. adarsh
    Permalink to comment#

    not working in ie

Leave a Comment

Current day month ye@r *

*May or may not contain any actual "CSS" or "Tricks".