JSFiddle - React, Tailwind, and code Playground

by dekajp

HTML

<h3>Instructions</h3>
<p>Instead of using the spinner buttons, use the keyboard to alter the value.</p>

<input class="spinner ui-spinner-input" type="text" name="test" value="1" />
<div id="append"></div>

<p>Notice that the stop event is called even when keys are pressed that do not alter the value (such as Alt, Esc, Ctrl)</p>

JavaScript

$('.spinner').spinner({
    min : 0,
    max : 100,
    stop: function( event, ui ) {
        $('#append').append("<div>" + event.currentTarget.tagName + "  Key Pressed :  "+  event.which  + "</div>");
    }
});