Given the following HTML:
<div id="foo"> <p>hello world</p> </div> <p id="message">Event not yet triggered</p> And the following JS:
$('#foo').bind('customEvent', function() { $('#message').text('Event triggered!'); }); $.event.trigger('customEvent'); My p tag is changed in jQuery 1.8 (JSFiddle), but not in 1.9 (JSFiddle).
Why is this? I can't see anything relevant in the changelog for 1.9. What's the best approach to use in 1.9+?
$('#foo').trigger('customEvent');as thats the element you bound the event to.on()instead of.bind().