JSFiddle - React, Tailwind, and code Playground

by dmethvin

HTML

<p>test: click in the input field and hold mouse button down. then playing with ctrl key should alternatively change cursor on up or down event... this works except in chromium as long as mouse button is held down key cursor css doesn't change</p>
<br>
<input id="txt" type="text">
<div id=test></div>

JavaScript

var txt = document.getElementById("txt"),
    test = document.getElementById("test");

    txt.onkeydown = function(e){
        if (e.keyCode==17){ // ctrl
            txt.style.cursor = "move";
            test.innerHTML += " down";
        }
    };
    txt.onkeyup = function(e){
        if (e.keyCode==17){ // ctrl
            txt.style.cursor = "pointer";
            test.innerHTML += " up";
        }
    };