How to call multiple JavaScript functions in onclick event?

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

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

11条回答
  •  忘了有多久
    2020-11-22 07:14

    Sure, simply bind multiple listeners to it.

    Short cutting with jQuery

    $("#id").bind("click", function() {
      alert("Event 1");
    });
    $(".foo").bind("click", function() {
      alert("Foo class");
    });
    
    
    Click

提交回复
热议问题