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

Clearcase check in/uncheck out all the checked out files script

MSSQL GROUP_CONCAT

Duplicating a local copy of project from TFS and making web software client factory to work