以下を参照してください。
$('body').on('whyhellothere', function(){
console.log('done...');
});
$('body').triggerHandler('whyhellothere');
このスニペットは次を返します。
done...
一方、順序を逆にすると:
$('body').triggerHandler('whyhellothere');
$('body').on('whyhellothere', function(){
console.log('done...');
});
このスニペットは何も返しません。これはなぜですか?