Exclamation mark doesn't work in trigger() when using event namespace in jQuery 1.9

前端 未结 2 447
醉梦人生
醉梦人生 2021-01-05 00:24

Here is the code:

$(\"div\").on(\"click\",function(){
       console.log(\"click\");
});
$(\"div\").on(\"click.plugin\", function(){
       console.log(\"cli         


        
2条回答
  •  天命终不由人
    2021-01-05 01:09

    Use .$ instead of !

    $("button").click(function() {
          $("div").trigger("click.$");    
    });
    

    Demo [Credits: Tim B James]

提交回复
热议问题