JSFiddle - React, Tailwind, and code Playground
by Tan
HTML
<!-- Form field increment buttons -->
<button onclick="decrementValue()"><</button>
<input type="text" id="number" value="0.54" step="0.01">
<button onclick="incrementValue()">></button>
CSS
body {margin:50px;}
JavaScript
// Form field increment buttons
function incrementValue()
{
var value = document.getElementById('number').value;
var newvalue = parseFloat(value) + parseFloat('0.01');
document.getElementById('number').value = newvalue.toFixed(2) + '%';
}
function decrementValue()
{
var value = document.getElementById('number').value;
var newvalue = parseFloat(value) - parseFloat('0.01');
document.getElementById('number').value = newvalue.toFixed(2) + '%';
}