Can I do this:
$('.box').delegate('.edit', 'click', function(edit_event){
...
var input = $('input', this);
input.focus().bind('blur keypress', function(event){
// here disable the first .edit event (don't allow click on that element)?
});
});
the event would be enabled again if certain conditions are met inside the 2nd event (and when a AJAX call is complete)
Since you’re using the
delegate()[docs] method, which is selector based, you could just add a class to the current.editthat excludes it from the selector.I used the
not-selector[docs] so that theclickevent won’t fire until thedisableclass is removed.