JSFiddle - React, Tailwind, and code Playground

by chrimbus

HTML

<div>Type: Hello to win</div> 
<div>Anything else no win</div> 
<br>
    <br>
<form>
  <fieldset>
    <label for="target">Type Something:</label>
    <input id="target" type="text">
  </fieldset>
</form>
<button id="other">
  Trigger the handler
</button>
    <img class="ghost"         src="http://i.imgur.com/CwuuGpZ.png">

CSS

.ghost {
    width:40px;
    height:40px;
}

JavaScript

var xTriggered = 0;
$( "#target" ).keyup(function( event ) {
  xTriggered++;
  var msg = "Handler for .keyup() called " + xTriggered + " time(s).";
  $.print( msg, "html" );
  $.print( event );
}).keydown(function( event ) {
  if ( event.which == 13 ) {
    event.preventDefault();
  }
});
 
$( "#other").click(function() {
  $( "#target" ).keyup();
});