I need some scripts inside an existing site’s scripts.js.
This site has been online for ages, and I can not touch the scripts file.
I am including it standardly in another page. There are numerous jQuery calls in the scripts file. The place I include it does not have jQuery.
I want to void all $() type things. I tried this…
$ = function() { };
before I included scripts.js and it didn’t seem to work. I am still getting errors like
$(document) is undefined
Is there a way to void all these jQuery calls?
Thanks
Even if you do get that working, you’ll still have problems because the code was written with the assumption that jQuery was present. Yes, you can avoid
$ is null or not definederrors on lines like this:But there’s no point in just writing that line: there will always be actions on the returned object:
After the NOP jQuery function, you’ll get a
"html" is not a functionerror, and so on. The only way you could do it would be to fill out a skeleton of every possible jQuery method, making sure each one returns itself when appropriate.…or just rewrite it properly…