JSFiddle - React, Tailwind, and code Playground

by petroveg

HTML

<button type="button" data-id="1">Кнопка</button>
<button type="button" data-id="2">Кнопка</button>
<button type="button" data-id="3">Кнопка</button>
<button type="button" data-id="4">Кнопка</button>
<button type="button" data-id="5">Кнопка</button>

CSS

button[data-id]:after{
	content:" " attr(data-id);
}
button[data-id].__active{
	margin-left:30px;
}

JavaScript

$(document).on('click', 'button[data-id]', function (e) {
	$(this).toggleClass('__active');
});