JSFiddle - React, Tailwind, and code Playground

by Krishna Gopinath

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;
    }
});