JSFiddle - React, Tailwind, and code Playground
by tmtron
HTML
<html>
<body>
<script>
function testFunc(){
alert("onmouseup called");
}
function dispatchMouseEvent() {
var evt = document.createEvent("MouseEvents");
evt.initEvent("mouseup", true, true);
document.getElementById("x").dispatchEvent(evt);
}
</script>
<input type="button" value="Test" id="x" onmouseup="testFunc()"/>
<script>
setTimeout(dispatchMouseEvent, 500);
// document.getElementById("x").onmouseup();
</script>
</body>
</html>