How to run a callback function on a jQuery trigger(“click”)?

后端 未结 8 1937
太阳男子
太阳男子 2021-01-03 18:44

I need to trigger a custom event in the callback of a trigger call, but I can\'t get it to work.

I tried this:

var $input = $( \".ui-pop         


        
8条回答
  •  半阙折子戏
    2021-01-03 19:12

    The Trigger doesn't have a callback function - you can better re-write your code to use the .on method.

    $("body").on("click", "#click", function() {
       alert("Clicked!"); 
    });
    

    JSFiddle.

提交回复
热议问题