JSFiddle - React, Tailwind, and code Playground
HTML
<input id="txt" type="text"/>
<p>Moves</p><p id="moves">0</p>
<p>Downs</p><p id="downs">0</p>
<p id="activity">Activity</p>
JavaScript
$( "#txt" ).mousedown(function() {
document.getElementById("activity").innerHTML +="D";
update(false,true);
});
$( "#txt" ).mousemove(function() {
document.getElementById("activity").innerHTML +="M";
update(true,false);
});
function update(move, down)
{
var moves=document.getElementById("moves").innerHTML;
if (move)
{
moves ++;
document.getElementById("moves").innerHTML=moves;
}
var downs=document.getElementById("downs").innerHTML;
if (down)
{
downs ++;
document.getElementById("downs").innerHTML=downs;
}
var d=parseInt(downs);
var m=parseInt(moves);
if ((d+m)%25==0)
{
document.getElementById("activity").innerHTML +="<br>";
}
}