Reputation: 793
I would like to call the following event handler from within another function without having to split the code out into another function:
$('#welcome select').change(function () {...});
Is this possible?
Upvotes: 1
Views: 166
Reputation: 57719
function handler() {
// do stuff
}
$('#welcome select').change(handler);
handler();
Upvotes: 0
Reputation: 25776
Sure, you can trigger the change event.
$('#welcome select').trigger('change');
Upvotes: 7