Can someone enlighten me on the jQuery delegate, what events are handled and what aren't. The follow code doesn't work
$("#browser").delegate( ".photo", {
"load": function(e) {
alert("photo loaded");
}
});
but the following code work
$(".photo").load( function(e) {
alert("photo loaded");
} );
I also try to delegate changeData event to a class which doesn't work as well
$("#browser").delegate( ".thumbnail", {
"changeData": function(e, prop, value) {
alert( prop + " = " + value );
}
});
but the following code work
$(".thumbnail").bind( "changeData", function(e, prop, value) {
alert( prop + " = " + value );
}
Not:
$("#browser").delegate( ".photo", {
"load": function(e) {
alert("photo loaded");
}
});
But:
$("#browser").delegate( ".photo", "load",
function(e) {
alert("photo loaded");
});
And you cannot use live and delegate with those events, because they don't bubble.
These events do not bubble, so they cannot be used with live
or delegate
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With