Trigger

Programatically trigger keypress event from a dom node?

I've got a textbox which I programatically want to trigger a keypressed event from. The event must be "custom" with certain attributes set (shiftKey).

I've got this to work successfully in FF, but in IE it refuses to take in my custom event. Here's my IE code:

// create custom event
var newEvent = document.createEventObject();
newEvent.shiftKey = true;
newEvent.type = "keypress";
newEvent.charCode = dojo.keys.ENTER;

// fire event from dom node
var domNode = dojo.byId("somenode");
domNode.fireEvent("onkeypress", newEvent); // this line don't work :(, event never gets fired
domNode.fireEvent("onkeypress"); // this line work, but without the custom event

Does Dojo provide functionality for triggering events programatically from a dom node like this? If not does anyone know how to make it work?

Thanks!

Syndicate content

Back to top