0

I know there is this repository for binding an event handler as first to be executed. I would like to achieve the same with pure JavaScript, but I read here that it ain't possible to check for the event-listeners being attached to an element. If so, is there another way to do this (preferably cross-browser down to IE9)?

My usecase for this is to execute a event-handler before another one which I can't control as it is added by a JavaScript-framework. There might be better work-arounds for my specific case, but I would like to know, if there is a general solution to this problem.

0

1 Answer 1

0

I think, setTimeout(...,0) does the trick. There is also important if event is sync or async. This article could be helpful.

Sign up to request clarification or add additional context in comments.

1 Comment

setTimeout does delay the function-execution, but the other way round is not possible. Thank you for the interesting link though!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.