I want to execute the following:
$('#AccountID').change(SelectAccounts);
and then (SelectProducts)
Is there some way I can make the function SelectProducts execute after SelectAccounts all on the same line?
I want to execute the following:
$('#AccountID').change(SelectAccounts);
and then (SelectProducts)
Is there some way I can make the function SelectProducts execute after SelectAccounts all on the same line?
How about:
$("#AccountID").change(SelectAccounts).change(SelectProducts);
(in jQuery, event handlers are executed in the order they're bound. SelectAccounts
will always run before SelectProducts
)
Those are two different functions so you'd need to call them separately.
$('#AccountID').change(function () {
SelectAccounts();
SelectProducts();
});
In case you need to control the exact execution time for the second function, this discussion might be useful: Upon Link Click and setTimeout
use jQuery.Callbacks()
added from jQuery v1.7
var callbacks = $.Callbacks();
callbacks.add( SelectAccounts);
callbacks.add( SelectProducts );
//then use callbacks.fire() with supported flags