JSFiddle - React, Tailwind, and code Playground
HTML
<input type='button' id='test' value='test'/>
JavaScript
if(!(Event.prototype.stopEvent))
{
Event.prototype.stopEvent = function(propagate)
{
"use strict";
propagate = (propagate ? true : false);
if (this.preventDefault)
{
this.preventDefault();
if (propagate === false)
{
this.stopPropagation();
}
}
else
{
this.returnValue = false;
this.cancelBubble = !propagate;
}
return (this);
};
}
function testEvent(e)
{
e = e || window.event;
if (e.stopEvent)
{
e.stopEvent();
document.write('OK');
return;
}
document.write('FFS');
}
window.onload = function()
{
document.getElementById('test').onclick = testEvent;
}