JSFiddle - React, Tailwind, and code Playground

by lasha

HTML

<div class="blah" data-colors="red blue green black">XL</div>

JavaScript

$(".blah").click(function(e){
    var dataAttr = $(this).data("colors");
    
    alert(dataAttr);
});