JSFiddle - React, Tailwind, and code Playground
HTML
<span id="minus">-</span><input type="text" class="numbertype" value="0" /><span id="plus">+</span>
<label></label>
CSS
#minus, #plus { padding: 10px; background: #f1f1f1; display: inline-block }
JavaScript
var i = null;
var d = 0;
var $numbertype = null;
function ToggleValue() {
$numbertype.val(parseInt($numbertype.val(), 10) + d);
}
$(function() {
$numbertype = $(".numbertype");
$("#minus,#plus").mousedown(function() {
d = $(this).is("#minus") ? -1 : 1;
i = setInterval(ToggleValue, 100);
});
$("#minus,#plus").on("mouseup mouseout", function() {
clearInterval(i);
});
});