I spent half an hour trying to figure this out, and then I thought it was like this.
Menu
When you click
, the hyperlink inside is triggered:
// Correct choice
$("li.menu").children("a")[0].click()
// The following will not work
$("li.menu").children("a").eq(0).click()
--it will say that the parameter is wrong and the bound click event function was not found ,
--Because eq(0) returns a jQuery object, when click() occurs, it will find the function bound to it, but there is no bound function at all, so an error is reported.
, and [0] returns a DOM object. When click() occurs, the original behavior of the element will be executed.
Note: [0] This is equivalent to get(0).