Javascript 我可以在jQuery中链接函数调用吗?
我要执行以下操作:Javascript 我可以在jQuery中链接函数调用吗?,javascript,jquery,Javascript,Jquery,我要执行以下操作: $('#AccountID').change(SelectAccounts); and then (SelectProducts) 有什么方法可以让SelectProducts功能在SelectAccounts都在同一行后执行吗?怎么样: $("#AccountID").change(SelectAccounts).change(SelectProducts); (在jQuery中,事件处理程序按绑定顺序执行。SelectAccounts将始终在SelectProduc
$('#AccountID').change(SelectAccounts);
and then (SelectProducts)
有什么方法可以让SelectProducts功能在SelectAccounts都在同一行后执行吗?怎么样:
$("#AccountID").change(SelectAccounts).change(SelectProducts);
(在jQuery中,事件处理程序按绑定顺序执行。SelectAccounts
将始终在SelectProducts
之前运行)如何:
$("#AccountID").change(SelectAccounts).change(SelectProducts);
(在jQuery中,事件处理程序是按绑定顺序执行的。
SelectAccounts
总是在SelectProducts
之前运行)这是两个不同的函数,因此需要分别调用它们
$('#AccountID').change(function () {
SelectAccounts();
SelectProducts();
});
如果您需要控制第二个函数的确切执行时间,此讨论可能很有用:这是两个不同的函数,因此您需要分别调用它们
$('#AccountID').change(function () {
SelectAccounts();
SelectProducts();
});
如果您需要控制第二个函数的确切执行时间,此讨论可能会很有用:使用从jqueryv1.7添加的
var callbacks = $.Callbacks();
callbacks.add( SelectAccounts);
callbacks.add( SelectProducts );
//then use callbacks.fire() with supported flags
使用从jQuery v1.7添加的
var callbacks = $.Callbacks();
callbacks.add( SelectAccounts);
callbacks.add( SelectProducts );
//then use callbacks.fire() with supported flags