Listening For Other Events

You can listen for normal events (such as click) on normal events, just like we did in the sample index.js earlier in this guide.

Once again, you must unbind the event when you're done, so to help with this we have the Recite_Tabs.Bind() method. The first argument is the widget; the second argument is the element (or list of elements) to bind the event to; the third argument is the event to bind; the final argument is the event handler function.

Here's the code we used to bind an event to the button we created when creating our sample widget.

Recite_Tabs.Bind(
    widget,
    widget.find('button[name=foo]'),
    'click',
    function(e) {
        e.preventDefault();
        
        Recite_Dialog.Alert({
            msg : 'Button was clicked!'
        });
    }
);