I've this problem
I've some element, actually <li>
elements, and over these element I've one operation applied to them, easily done like this:
$('.panelTabs li').on('click', function () {
// ..some operation that change some tab associated to the list
});
then in my code i need to apply another click operation that has to check if I can execute the previous operation or not.
$('.panelTabs li').on('click', function (ev) {
// ..some operation that makes some check
if(bActiveRequests === 0){
ev.stopPropagation();
}
});
but the first function is applied before the second function containing the check, so of course my stopPropagation() cannot work, because it's executed after.
So I'm asking if there is a way to add anticipate a click function before a function already applied to the same element.
I thought about saving that function in a variable, then remove that function from the li, then add my function, then add the previous function... but that's a bit tricky and not nice at all.
I could include my second JavaScript file before the first one. But that is a bit tricky as well because of the code.
Any ideas?