How do I have a widget listen for clicks on other widgets but not listen to normal clicks on itself. For example:
var $dialogWidget = jQuery('#dialogWidget'); $dialogWidget .bind('click.btn1.otherWidget',doSomething) .bind('click.btn2.otherWidget',doSomething2) .bind('click.btn1.otherWidget2',doSomething3); The problem with this code is that when I click anywhere on $dialogWidget, all of these events that I have bound will be triggered. What I want is this
var $otherWidget = jQuery('#otherWidget'); var $btn1 = $otherWidget.find('a.btn1'); $btn1 .click(function(){ $dialogWidget.trigger('click.btn1.otherWidget'); }); This should be the only way that 'click.btn1.otherWidget' event is fired for $dialogWidget.
One possible thing I could do that would be a hack is anytime I am manually firing a click event is to use 'clicked' instead of click, but that feels like a hack. Any ideas?