Home  >  Article  >  Web Front-end  >  The click event is triggered by default when jQuery is run for the first time.

The click event is triggered by default when jQuery is run for the first time.

小云云
小云云Original
2018-01-11 13:26:585138browse

This article mainly shares with you an example of jQuery triggering a click event by default on the first run page. It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor to take a look, I hope it can help everyone.

For example:

1. $("#txt").trigger("click");//The default trigger is to click the search button

2. $ (".aaa .bbb").eq(0).click();//default first click (for example, UL's LI has multiple clickable ones for the default click first)

Note:

should be placed outside the function, otherwise it will not work

Related recommendations:

jQuery ajax dynamically adding nodes cannot trigger clicks How to solve the event

JQuery simulates a click event and automatically triggers the event

How the click event triggers the content change of the span element

The above is the detailed content of The click event is triggered by default when jQuery is run for the first time.. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn