JSFiddle - React, Tailwind, and code Playground

by Norlihazmey Ghazali

HTML

<select id="mySelect" class="a b c">
  <option value="1">A</option>
  <option value="2">B</option>
  <option value="3">C</option>
</select>

JavaScript

$('#mySelect').change(function () {
	var className = $( this ).attr( 'class' );
  var exp = className.split(' ');
  var newClass = $.map(exp, function (e,i) {
  	return '.' + e;
  }).join( ' ' );
  alert(newClass)
}).change();