0

I have an anchor within an li element, each with their own onclick handler.

When I manually click the link, which has a # href, both onclick events are fired. This is what I want. When I click the link by calling document.links[0].onclick(), only the inner onclick event fires.

I cannot change the page itself, only the javascript to be executed.

user420667
  • 6,312
  • 14
  • 49
  • 83

1 Answers1

2

You are just invoking the function directly - there is no event involved, thus no bubbling. You need to trigger the event instead.

Community
  • 1
  • 1
Amadan
  • 179,482
  • 20
  • 216
  • 275