I'm working with some existing javascript code which takes an LI and makes it droppable to an input field. I wanted to add an additional constraint to this, and enforce this by making my own event handler, and calling event.stopImmediatePropagation() if the constraint is not met. This existing javascript is look like this:
$input.droppable({
accept: accept,
activeClass: 'droppable_active',
hoverClass: 'droppable_hover',
// tolerance: 'touch',
drop: function(e, ui)
{
// do some stuff;
}
And is initiated in my code via the following call:
$('form').dmFrontForm();
Which is a custom jQuery UI which sets that event handler.
Before I make this call, I setup my own handler:
$('input').('drop', function(e, ui) {
if (constraintIsNotMet) {
e.stopImmediatePropagation();
}
});
I verified the order that the event handlers were being called by adding in alert statements (actually no matter what order I put these lines of code, my handler always responded first which is a bit fishy to me), but no matter how hard I try, I can't get the first handler to quit.