Result
マウスドラッグした文字数を数えます。JSはバニラです
使う機会があるかは分かりません
js
function biR() { document.addEventListener("mousedown", rOS); document.addEventListener("mouseup", rOS); document.addEventListener("onkeyup", rOS); document.addEventListener("onkeydown", rOS); document.addEventListener("onkeydown", rOS); document.onselectionchange = function() { rOS(); }; } function rOS() { var cout, rts, rt; c = window.getSelection().toString().length rts = document.getElementsByClassName('cR'); for (var i = 0; i < rts.length; i++) { rt = rts[i]; for (var i = 0; i < rt.childNodes.length; i++) { if (rt.childNodes[i].className == "cC") { rt.childNodes[i].innerText = c; } } if (c > 0) { rt.classList.remove("df"); } else { rt.classList.add("df"); } } } function stopTest() { clearInterval(test); } biR();