JSFiddle - React, Tailwind, and code Playground

by bateast

HTML

<div class="test"></div>

CSS

div > div:hover {
    background-color: #ccc;
    cursor: pointer;
}

JavaScript

$(function(){
    var ary = ['a', 'b', 'c'];

    for(var i in ary) {
        var msg = ary[i];
        $('<div/>').html(msg).click(function() {
            alert(msg);
        }).appendTo('.test');    
    }
});