How do you catch a click event with plain Javascript?

后端 未结 6 1618
挽巷
挽巷 2021-01-31 10:11

I know that when using jQuery you can do $(\'element\').click(); to catch the click event of an HTML element, but how do you do that with plain Javascript?

6条回答
  •  不知归路
    2021-01-31 10:15

    Here is an interesting article about that, i used the same approach some times, basically, you add the event handler to window. http://mislav.uniqpath.com/js/handling-events-on-elements/

提交回复
热议问题