I’m using jQuery Mobile Ajax navigation feature, And I need to change a variable that is defined inside external js file, So I can’t put my definition before I load that js file…
So, How to change value of a variable for external javascript file after the js file is defined?
(That external js file includes events)
So this question is not duplicate of that question.
Update
My JS File contains events, something like this: $(document).on('mousemove','#main',function() { /*something*/} );
And I need that variable. Is it possible to pass variable to that?
I have tried simply changing that variable i = 5;, but I’m getting undefined error.
Update 2
The external JS file is something for some pages that are almost same, but a little different, just one or two parameters.
And I simply want to pass the parameters to that JS file. Is it possible? How?
Let’s assume
http://www.example.com/external.jsdefines variablefoo, which you want to change.This assumes that external.js defined
fooin the global scope. If it’s defined in an anonymous function or similar, you won’t be able to change the value.