3

I have this bit of code that does not work on future events:

$(document).on("change","#cboOne","#cboTwo" , function() {
    alert("okAll");
}

but if I separate it ... works fine:

$(document).on("change","#cboOne", function() {
    alert("ok1");
}
$(document).on("change","#cboTwo" , function() {
    alert("ok2");
}

Why the first way do not works? Any idea? tks

4

1 回答 1

1

API doc: on http://api.jquery.com/on/

This should fit your cause :)

Try this:

$(document).on("change","#cboOne,#cboTwo" , function() {
    alert("okAll");
});
于 2013-10-12T05:12:09.060 回答