I'm working on an application where I'm using JS to inject some elements into the DOM. I have a javascript function that I can't change the code for as it's part of a 3rd party install I don't have access to - it also changes the HTML content of the page when called. I can access it For simplicity's sake, I'll omit the detailed code and substitute with example code below.
cant_change() is fired during an event I don't have access to.
function I can't change
function cant_change() {
return "can't change";
}
function I can change
function will_change() {
return "will change";
}
The specific question I have is: How can I fire the function will_change after cant_change fires? I can use jQuery too if that helps.
cant_changeto be fired? If you can't do that, the only thing I can think to do would be to monkey patch the library implementingcant_changeso that it calls the original implementation before yours. Ifcant_changeis also async this could be pretty tricky.cant_changeis actually a public method rather than just a function definition. If that's the case you won't be able to call it or patch it in directly at all and will have to go by the event.