I'm encountering a strange issue specifically on IE 9. The code works perfectly fine in Chrome and Firefox, but not in Internet Explorer. Below is the relevant code snippet:
This problem is occurring in a legacy application built with VS2008. The "corp framework" dynamically defines field masks using JavaScript's `onkeyup` event like this:
Javascript:
function mask(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 functionality and postback event are working correctly in all browsers except for IE9. Interestingly, when I remove the `setTimeout` from the JavaScript mask function, the postback works but the masking behavior is lost.
I have observed that setting `AutoPostBack=true` results in an `onchange` event with `setTimeout`. This conflicts with the additional use of `setTimeout` in the mask function. Removing `setTimeout` from the mask enables the postback to work in 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="mask(this, mnum);">
I am struggling to identify the root cause of the issue in IE9 and find a suitable solution.