Say I want event A to happen all the time, but if event B were to happen, then event A should happen after event B. My event B is clicking on a div. So I want event A to always perform, but if I were to click on a div, I want that to happen before event A happens.
Using the trigger events, then event A would not happen unless event B occurs.
This is what I have so far
$('body').on({
click: function()
{
var el = $(this);
if( el.val() == "Select Task" ){
el.val('');
}
lookUpTask(el);
el.focus(function() {
}).blur(function() {
$('body').on({
click: function(event)
{
alert('This should happen FIRST');
el.trigger('remove_match');
}
},'.match', function(){
alert('sd2');
});
if( el.val == "" ) {
el.val('Select Task');
}
el.bind('remove_match', function(){
el.parent().children('.match_results').remove();
});
});
},
keyup: function(event)
{
lookUpTask($(this));
}
},'.task_select');
So on el.blur, I want to remove match, UNLESS match is clicked first. In that case, I want to process something, and then remove it.