Reputation: 7599
i've made a textbox widget which will highlight onFocus (and "un-highlight" onblur). my question: i'd like to append another event to the blur-event AFTERWARDS which will eg. display a messsagebox.
i know i can assign multiple events with bind but i'd need to add that extra event after bind was already assigned.
how would this be possible?
thanks
Upvotes: 0
Views: 735
Reputation: 17825
If you are wanting to bind after blur has triggered:
$('.myelement').blur(function() {
$(this).bind('mycustomevent', function() {
// code here
});
});
If you are wanting to bind right after blur has bound:
$('.myelement')
.blur(function() {
// code here
})
.bind('mycustomevent', function() {
// code here
});
If you want to trigger the SAME functionality with blur AND your custom event:
$('.myelement').bind('blur mycustomevent', function() {
// code here
});
jQuery Binding: http://api.jquery.com/bind/
Upvotes: 1