jQuery on()

the customEvent will bubble from the inner element, but it will only trigger the function on the outer element.

by felvhage

HTML

<div class="outer"><div class="inner"></div></div>
<div id="result"></div>

JavaScript

$('.outer').on('customEvent', function(){
    $('#result').append('test');    
});
$('.inner').trigger('customEvent');