CodePen

HTML

            
              h1 <input> event test
form
  div
    input.inp[data-ref='i']
  div
    textarea.inp[data-ref='t']
  div
    input[type="reset"]
    button[type="button"] random
div
  h2 onChange
  div
    'input content:
    span#change-i
  div
    'textarea content:
    span#change-t
div
  h2 onInput
  div
    'input content:
    span#input-i
  div
    'textarea content:
    span#input-t
div
  h2 onKeydown
  div
    'input content:
    span#keydown-i
  div
    'textarea content:
    span#keydown-t
            
          
!

CSS

            
              html{
  margin: 1em 2em;
  font-family: sans-serif;
}
span{
  background:#b6f087;
}
            
          
!

JS

            
              $(function(){
  console.clear();
  var inp = $('.inp');
  var btn = $('button');
  inp.on('input change keydown',function(e){
   var ref = $(this).data('ref');
    $("#"+e.type+'-'+ref).text(this.value);
  });
    btn.click(function(){
      inp.each(function(){
        this.value = Math.random();
      }); 
    });
});
            
          
!
999px
Loading ..................