JSFiddle - React, Tailwind, and code Playground

by mariocatch

HTML

<button id="btn">
  Click Me!
</button>

CSS

.green {
  color: green;
  background: black;
}

JavaScript

/*
	Requirements: I need a button to change its color when clicked/"unclicked" 
  	and call another function when it is clicked
*/

$(document).ready(function() {
	$('#btn').click(function() {
  	var btn = $(this);
    btn.toggleClass('green');
    
    // Do some extra code here.
  });
});