Is dispatchEvent a sync or an async function

It’s guaranteed to be synchronous because: The return value of dispatchEvent indicates whether any of the listeners which handled the event called preventDefault. Since the return value indicates whether any of the listeners that handled the event called preventDefault, the method must block (not return) until all of the listeners are done executing, which is … Read more

Using jQuery with Windows 8 Metro JavaScript App causes security error

You need to edit the jQuery source so that you pass the jQuery.support function to MSApp.execUnsafeLocalFunction, which disables the unsafe content checking, like this: jQuery.support = MSApp.execUnsafeLocalFunction(function() { var support, all, a, select, opt, input, fragment, tds, events, eventName, i, isSupported, div = document.createElement( “div” ), documentElement = document.documentElement; // lots of statements removed for … Read more

how to reset

The jQuery solution that @dhaval-marthak posted in the comments obviously works, but if you look at the actual jQuery call it’s pretty easy to see what jQuery is doing, just setting the value attribute to an empty string. So in “pure” JavaScript it would be: document.getElementById(“uploadCaptureInputFile”).value = “”;