api.jquery.com
api.jquery.com copied to clipboard
Documentation about `trigger()` unclear about calling native event
Description
Does $('a#id77').click()
open the link of <a>
?
Reading https://api.jquery.com/trigger/, I am not sure if native event is called, but I guess so. But at least, it does not.
There is also a stackexchange discussion: https://stackoverflow.com/questions/5811122/how-to-trigger-a-click-on-a-link-using-jquery
Please update the documentation to clearly mention if native events are triggered. And if necessary, fix any bug.
Link to test case
The link is not shown when doing a jquery click: https://jsbin.com/jifulaweqa/1/edit?html,js,output
We have never triggered .click
on anchor tags because not all of our supported browsers had this method available, which would have made the behavior inconsistent. However, I'm surprised I don't see mention of this in the docs.
Thanks. This agrees with https://learn.jquery.com/events/triggering-event-handlers/
So my request is to update the documentation.
I still am irritated what the term "native event" refers to, and why event.preventDefault()
is mentioned when default is not run.
By the way, is it expected that the native click event is called for a parent <a>
element? This seems to happen according to https://stackoverflow.com/a/21334234