JSFiddle - React, Tailwind, and code Playground

by Nik Shevchenko

HTML

<button id="your-button-id">Click here</button>

JavaScript

// Here's our button
var button = document.getElementById('your-button-id');
// Get the values
var cmd = button.getAttribute('data-cmd');
var id = button.getAttribute('data-id');
// Change the values

$('#your-button-id').on('click', function() {
	var yourNewCmd = 'lol';
	var yourNewId = 'rofl';
	button.setAttribute('data-cmd', yourNewCmd);
	button.setAttribute('data-id', yourNewId);
  console.log($(this).attr('data-cmd'));
  console.log($(this).attr('data-id'));
  
  if($('#your-button-id').attr('data-cmd')) {
	console.log('upyachka');
	};
});