How to call multiple JavaScript functions in onclick event?

后端 未结 11 822
梦如初夏
梦如初夏 2020-11-22 06:25

Is there any way to use the onclick html attribute to call more than one JavaScript function?

11条回答
  •  -上瘾入骨i
    2020-11-22 07:23

    onclick="doSomething();doSomethingElse();"
    

    But really, you're better off not using onclick at all and attaching the event handler to the DOM node through your Javascript code. This is known as unobtrusive javascript.

提交回复
热议问题