JSFiddle - React, Tailwind, and code Playground
HTML
<button type="button" id="button">Save</button>
JavaScript
$('#button').click(function(){
$(this).text(function(_, val){
return val == 'Save' ? 'Edit' : 'Save';
});
});
<button type="button" id="button">Save</button>
$('#button').click(function(){
$(this).text(function(_, val){
return val == 'Save' ? 'Edit' : 'Save';
});
});