My webpage is including a .js file whose functionality I have to change/replace/expand.
I have the new JS all written out and included in my webpage, but I can't get it to overwrite the original script or prevent the original script from executing.
Assume I am unable to remove the original <script> element from the page, but I am able to include my new script before the original script.
EDIT: Here's how it's laid out:
<script src="my-new-script.js"></script>
<!-- Some HTML -->
<!-- I want to replace the functionality of the below script with
"my-new-script.js" and/or prevent my-old-script.js from executing -->
<script src="my-old-script.js"></script>
The reason:
my-old-script.js is being loaded by a WordPress theme, and for my purposes I cannot change the theme or alter PHP files of the theme, so I cannot prevent my-old-script.js from being loaded. But, I can include my-new-script.js via Widgets
I looked at some of the answers given here, but they didn't seem to apply to my scenario