I've a strange situation on IE 9. It just works in Chrome and Firefox. I will post only the relevant code.
It's a legacy application (VS2008). The "corp framework" defines field masks at runtime, it uses the onkeyup event, with javascript like this:
Javascript:
function mascara(o, f) {
v_obj = o
v_fun = f
setTimeout(function() {
v_obj.value = v_fun(v_obj.value)
}, 1)
}
ASP.NET HTML:
<asp:TextBox runat="server" ID="TextBox5" AutoPostBack="true" OnTextChanged="TextChanged" />
The mask and the postback event works in all browsers except IE9. When I remove the setTimeout in the javascript mask function, the postback works, but i lost the mask behavior.
I figure out that AutoPostBack=true will render the onchange event with setTimeout. The mask uses another time the setTimeout function, when I remove the setTimeout in the mask, the postback works at IE 9.
Rendered HTML:
<input name="TextBox5" type="text" onchange="javascript:setTimeout('__doPostBack(\'MPTextBox5\',\'\')', 0)" onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" id="MPTextBox5" onkeyup="mascara(this, mnum);">
I can't figure out what is the problem at IE9 and the solution.
MS will not fix this bug:
https://connect.microsoft.com/IE/feedback/details/761843/wont-fire-change-event-if-value-of-input-is-changed-using-keyup
Workaround found at: http://bugs.jquery.com/ticket/10818