JSFiddle - React, Tailwind, and code Playground
HTML
<button>Add One More?</button><br>
<div data-foo="0">How much?</div>
CSS
div {
width: 200px;
height: 100px;
background: #269d4f;
color: #FFF;
line-height: 100px;
text-align: center;
font-size: 20px;
border-radius: 10px;
margin: 20px 0;
cursor:pointer;
}
JavaScript
$('div').click(function () {
alert($(this).data('foo'));
});
$('button').click(function () {
var count = $('div').data('foo') || 0;
$('div').data('foo', count + 1) ;
});