May 9, 2013
Exclamation mark doesn't work in trigger() when using event namespace in jQuery 1.9
User2301368’s Questions:
Here is the code:
$("div").on("click",function(){
console.log("click");
});
$("div").on("click.plugin", function(){
console.log("click.plugin");
});
$("button").click(function() {
$("div").trigger("click!");
});
and the HTML:
<div>test.</div>
<button >Trigger event according to namespace</button>
When I run the code under jQuery 1.8.3, it works. When I click button, it logs click
in the console.
But when I change to jQuery 1.9.1, nothing happens when I press the button. It seems like the exclamation mark doesn’t work anymore in 1.9.1.
I can’t find this change in the 1.9 upgrade guide. Does anybody know why?