哪个是一个接一个地调用两个点击事件的正确方法?

Which is right way to call two click event one after another?

我想在点击按钮时触发点击事件。我在下面编写了代码,两者都对我有用,但我想知道哪个更好。

第一种方法:

 jQuery( "#responav li" ).click(function() {
     jQuery( "#close-icon" ).click();
    });

第二种方法:

jQuery( "#responav li" ).click(function() { 
     jQuery( "#close-icon" ).trigger("click"); 
   });

$.trigger('click') 性能更高一些,因为 $.click() 只运行 $.trigger('click').

来自https://api.jquery.com/click/

This method is a shortcut for [...] .trigger( "click" )

http://api.jquery.com/trigger/

Any event handlers attached with .on() or one of its shortcut methods are triggered when the corresponding event occurs. They can be fired manually, however, with the .trigger() method. A call to .trigger() executes the handlers in the same order they would be if the event were triggered naturally by the user.