JSFiddle - React, Tailwind, and code Playground

by MuhammadHani

HTML

<button id="minus" href="#" style="height: 28px; width:128px;">-</button>
<span id="valueTempe" style="font-weight: bold; color: #fea100; width:28px;">0</span>
<button id="plus" href="#" style="height: 28px; width:128px;">+</button>

JavaScript

var valueElement = $('#valueTempe');
function incrementValue(e){
	if(valueElement.text() < 6){
		valueElement.text(Math.max(parseFloat(valueElement.text()) + e.data.increment).toFixed(1)); 
	}
	if(valueElement.text() == 6){
		valueElement.text(Math.max(parseFloat(valueElement.text()) -1).toFixed(1));
	}
    return false;
}


$('#plus').bind('click', {increment: 0.1}, incrementValue);		
$('#minus').bind('click', {increment: -0.1}, incrementValue);