JSFiddle - React, Tailwind, and code Playground

HTML

<input id="update" type="button" value="update" />

JavaScript

$("#update").click(function () {
       if (this.value == "update") {
           this.value = "cancel";
           //more action
       } else {
           this.value = "update";
           //more action
       }
   });