I, perhaps naively, thought there weren’t any significant browser differences anymore, but compare the behaviour of the below in Firefox and Chrome
https://jsfiddle.net/2b5mnvwt/1/
Specifically, type some text in the textbox then press the button. The button click fires in Firefox but not in Chrome
Is the difference because of something I’m doing wrong or is it a well-known issue? Which is right?
document.getElementById("theTextBox").addEventListener("blur", OnBlur, false);
document.getElementById("theButton").addEventListener("click", ButtonClick, false);
function ButtonClick(e) {
console.log('button')
alert('button')
}
function OnBlur(e) {
console.log('blur')
alert('blur')
//e.relatedTarget.focus();
//e.relatedTarget.click();
}
<input id="theTextBox" type="text" />
<button id="theButton">Click Me</button>