JSFiddle - React, Tailwind, and code Playground

by troythompson

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="tussenstand">

<button value="1">1</button>
<button value="2">2</button>
<button value="4">4</button>
<button value="6">6</button>

JavaScript

var theTotal = 0;
$('button').click(function(){
   theTotal = Number(theTotal) + Number($(this).val());
    $('#tussenstand').val("Total: "+theTotal);        
});

$('#tussenstand').val("Total: "+theTotal);