JSFiddle - React, Tailwind, and code Playground
HTML
<button>Click to change to erase</button>
JavaScript
$("button").on({
"mousedown": function () {
$(this).text("Click to change to paint brush");
var erasing = true;
},
"mouseup mouseleave": function () {
$(this).text("Click to change to eraser");
var erasing = false;
}
});