JSFiddle - React, Tailwind, and code Playground

HTML

<div>Test if this is hovered over.</div>
<span>Press any key to check for hovering.</span>

CSS

div { border: solid 1px black; }

JavaScript

$(function() {
    var hova = 0;
    $("div").hover(function() { hova = 1; },
                      function() { hova = 0; });
    
    $(document).keyup(function() {
         if (hova) alert("hovering!");
         else alert("not hovering.");
    });
});