Win32 SendMessage equivalent in Javascript

Problem Statement:

Custom control written in Javascript can't immediate trigger the onchange event if
the textbox control are updated using the code. e.g. ctrl.value = "123";
It will only trigger the onchange when move focus to another control.

Solution:

Win32 SendMessage equivalent in Javascript


IE:

element.fireEvent('onchange');

And via DOM2 Events (for Gecko):

var evt = document.createEvent('HTMLEvents');
evt.initEvent('change', true, true);
element.dispatchEvent(evt);

Comments

Popular posts from this blog

Outlook : "operation failed, object could not be found. " when trying to close a PST.

Troubleshooting Outlook Express (IMAP, POP3, HTTP, NEWS) with the log file

MSSQL GROUP_CONCAT