Fake “click” to activate an onclick method

前端 未结 11 991
醉话见心
醉话见心 2020-11-28 10:11

I have an element with an onclick method.

I would like to activate that method (or: fake a click on this element) within another function.

I

11条回答
  •  爱一瞬间的悲伤
    2020-11-28 10:51

    I haven't used jQuery, but IIRC, the first method mentioned doesn't trigger the onclick handler.

    I'd call the associated onclick method directly, if you're not using the event details.

提交回复
热议问题