Internet Explorer only.
<input type="button" id="but" value="button2"/>
<textarea id="text" cols="40" rows="20"></textarea>
window.onload = function() {
var el = document.getElementById("text");
var but = document.getElementById("but");
el.onbeforedeactivate = function() { alert('out') };
but.onclick = function() { alert('click') };
}
When I click the button within the textarea (focus is on textarea), I expect both functions to trigger but its not happening.
Why?
Online Example
alertcauses all sorts of trouble, esp. on IE but frankly on other browsers as well. I would avoid it.Your example works fine if you don’t use
alert, but instead use another way of showing the events have been received:Updated fiddle
Tested on IE6, 7, and 8. With your original, I get the same result as you (just the “out” alert). With the update, I see both events do in fact occur.