JSFiddle - React, Tailwind, and code Playground
by Firman Syah
HTML
<h4>How to get Class from This DIV?
Just one class I want to take</h4>
<div class="class1 class2"></div>
<h4>THE CLASS NAME FROM THIS DIV IS: 'class1 class2'</h4>
<p id="result-class"></p>
JavaScript
var classFormDiv = $('.class1').attr('class');
$('#result-class').html('result=> ' + classFormDiv);