When I needed to trigger the click event of the a tag in a recent project, I encountered a little problem. I take it for granted that the layer is written like this: $("a").trigger('click'). However, it has not been able to trigger successfully.
Then I asked the powerful Du Niang.
turn out to be:
$('a').trigger('click') does not trigger the click event of the content in the a tag, but is equivalent to triggering the onclick of a itself, not an event like a user click.
If you need to trigger the user's click event, you need to use the trigger to trigger the click event of the content in the a tag, as follows:
// The page elements are as follows
// trigger event as follows
$('a span').trigger('click');
Note: The trigger event must be bound to the span in the a tag