Ask Your Question
4

Is there a way to alter the behavior of the onload event for a script element so that it is triggered every time the src is modified, rather than only once?

asked 2023-03-14 11:00:00 +0000

djk gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-12-13 14:00:00 +0000

bukephalos gravatar image

No, the onload event for a script element is only triggered once when the script is initially loaded. If you want to execute code every time the src is modified, you would need to use a different approach, such as periodically checking the src with a timer or using a library that handles dynamic script loading such as RequireJS.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-03-14 11:00:00 +0000

Seen: 8 times

Last updated: Dec 13 '22