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);