A difficult problem.
The script does something in mousedown, and then executes "keypress", "focusout", "keyup" anyway.
The question is how can I kill the two remaining events when one of them is completed.
I tried $(document).off() , $(this).off('focusout') and nothing works.
Any clues?
.on('mousedown', '.task-content', function() { // Make DIV Editable }) .on('keypress', '.task-content', function (e) { if (e.which == 13 && !e.shiftKey) { // Update DIV content to DB } }) .on('focusout', '.task-content', function() { // Update DIV content to DB }) .on('keyup', '.task-content', function (e) { if (e.which == 27) { // Return DIV to previous state } })
source share