views:

20

answers:

1

I just wonder is there's any way to fire any event via IE's event-triggering implementation - fireEvent. I've tried to use it but failed with all event except click. The only reason i've get interested with this issue it curiousity, thus, any answers like "just do not trigger events, it is a bad idea" - all such answers would be considered, well...not full)))

thanks in advance

A: 

i had problems with that too, but jquery sometimes works, give it a try:

var eventObject = {};
eventObject.type = 'keydown';
eventObject.ctrlKey = true;
eventObject.altKey = false;
eventObject.shiftKey = false;
eventObject.metaKey = false;
eventObject.screenX = false;
eventObject.screenY = false;
eventObject.clientX = false;
eventObject.clientY = false;
eventObject.relatedTarget = this;
eventObject.button = false;
eventObject.keyCode = 80;
eventObject.charCode = 0;
eventObject.bubbles = false;
eventObject.cancelable = false;
eventObject.windowObject = false;
eventObject.detail = false;
$(document).trigger({type: 'keydown', ctrlKey: true, altKey: false, which: 80, originalEvent:eventObject });
Thariama
Thariama, as far as I know jquery doesn't handles native triggering at all (well, allmost at all) - telling trigger to jquery fires the chain of handlers being attach via juery bind. The only place in jquery-1.4.2 using fireEvent is for click.
shabunc