javascript - Simulate keypress using jQuery and fire oninput -


reacts testutils.simulate causes oninput function fire well. however, due restrictions, not able use that.

is there way of simulating, , thereby causing oninput function fire, kerypress using jquery?

do mean this?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <form> <fieldset> <label for="target">type something:</label> <input id="target" type="text"> </fieldset> </form> <button id="other">  trigger handler </button>   <script src="/resources/events.js"></script>    <script>    var xtriggered = 0;    $( "#target" ).keypress(function( event ) {    if ( event.which == 13 ) {    event.preventdefault();      }    xtriggered++;   var msg = "handler .keypress() called " + xtriggered + " time(s).";   console.log( msg, "html" );   console.log( event );  });   $( "#other" ).click(function() {  $( "#target" ).keypress();  }); </script> 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -