JSFiddle - React, Tailwind, and code Playground

by crowjonah

HTML

<div class="thing" id="el1">Hi</div>
<div class="thing" id="el2">How are you?</div>

CSS

.thing {width: 200px; height: 200px; background: lightGrey; margin: 5px;}

JavaScript

var el1 = document.getElementById('el1');
var el2 = document.getElementById('el2');

el2.addEventListener('mousemove', function(e) {
   //THIS SHOULD BE CALLED WHEN EITHER el1
    console.log('el2');
});

el1.addEventListener('mousemove', function(e) {
    //el2.trigger('mousemove');
});