JQuery simulates clicking on the A tag example reference

  • 2020-03-30 02:41:03
  • OfStack

I puzzled over the question for half an hour, and then I thought it was so.

The menu

<li class="menu"><a href="xxx.com" target="_blank"></a></li> 

Click < Li> When the inner hyperconnection is triggered:
//The right choice
//The following is not possible

- says parameter error, no bound click event function found,

Because eq(0) returns a jQuery object, when click() happens, it looks for a function bound to it, but it doesn't bind to a function at all, so it has an error.

, [0] returns a DOM object, and when click() occurs, the original behavior of the element is executed.

Note :[0] is the same thing as get(0).

Related articles: