Binding multiple events in jQuery

后端 未结 2 1952
清酒与你
清酒与你 2021-02-20 01:24

I have a custom jQuery plugin which binds a change event to a form element, in this case some input elements. The change event is used to

2条回答
  •  囚心锁ツ
    2021-02-20 01:43

    Events stack in jQuery. If you do:

    
    

    and:

    $(":button").click(function() {
      alert("click");
    }).click(function() {
      alert("click 2");
    });
    

    both will fire. So just bind another event to the relevant elements. It won't overwrite the first.

提交回复
热议问题