JSFiddle - React, Tailwind, and code Playground

HTML

<div id="root"></div>

CSS

.myinsert {
    position: absolute;
    width: 50px;
    height: 50px;
    background-color: blue;
    color: white;
    border: 1px solid red;
}

JavaScript

function insert() {
    var count = 10;
    
    while(count--) { 
        $('<div>', {
            'class': 'myinsert',
            text: 'out',
            css: {
                left: ~~(Math.random() * 200) + 'px',
                top: ~~(Math.random() * 200) + 'px'
            },
            mouseenter: function(e) {
                $(this).text('over');
            },
            mouseleave: function(e) {
                $(this).text('out');
            }
        }).appendTo($('#root'));
    }
}

$(function() {
    insert();        
});