I am trying to get the top nav bar's drop down menu working with the keyboard. What should happen is when a user presses the tab key and the top menu item is reached, the drop down should show just like the mouse hover event does.
Typically, I just add a function to the onfocus event that calls the mouseover event, but that isn't working. The following code causes a "TypeError: Object doesn't support property or method 'mouseover'" error.
var hoverMenuItems = document.getElementsByTagName('li');
for (x = 0; x < hoverMenuItems.length; x++) {
if (hoverMenuitem[x].className.indexOf('dynamic-children') != -1) {
hoverMenuItems[x].onfocusin = function () { try { this.mouseover(); } catch (err) { alert(err); } }
hoverMenuItems[x].onfocusout = function () { try { this.mouseout(); } catch (err) { alert(err); } }
}
}
I've already been informed that I can't modify any of the existing source code, so I need to find a solution that will modify the page after it's rendered.
Any help would be greatly appreciated.