JSFiddle - React, Tailwind, and code Playground
HTML
<div id="clickThis">Click This</div>
<div id="cost">25.00</div>
JavaScript
$("#clickThis").click(function(e){
e.stopPropagation();
var costVal = parseInt($("#cost").text(),10);
var costNewVal = costVal + 22;
var costOldVal = costNewVal - 22;
$("#cost").toggle(
function(){
$(this).text(costNewVal);
console.log("Huh?");
},
function(){
$(this).text(costOldVal);
console.log("Oh ok?");
}
);
});