JSFiddle - React, Tailwind, and code Playground JavaScript $(document).hover(function(e) { alert(e.type == 'mouseenter' ? 'enter' : 'leave'); });