I have something like the basic JavaScript jQuery code below that is only called once in my project code however it alerts 100+ times when my textarea attached to the event is focused by clicking my mouse cursor into it!
projectTaskModal.cache.$cmtTextarea.on('focus', function() {
alert('ON FOCUS EVENT');
});
My goal is to fire this event 1 time as it is used to simply add a CSS class and a few other tasks which are then removed after my Form is posted. A form is posted with an AJAX request and then it is ready for the next Focus
action to trigger the event again. However as mentioned it fires 100+ times each time I give it focus! Not good, please help!
You would be better of with a flag. Try this.