Firing a Javascript focus
event does not fire a click
event. Without seeing the relevant code, I'm led to guess that some click
handler is in place that is not being called in the case where you fire a focus
event.
You might try, instead, firing a click
:
var clickEvent;
if(document.createEvent) {
clickEvent = document.createEvent('click');
clickEvent.initMouseEvent('click');
divElement.dispatchEvent(clickEvent);
} else {
// Semi-pseudocode for IE, not tested, consult documentation if it fails
clickEvent = document.createEventObject();
divElement.fireEvent('onclick');
}
Or if you're into the jQuery thing:
$(divElement).click();
There's similar solutions for Prototype as well (search for Event.simulate).