Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete script loaded by .getScript()

When I load a script with .getScript('file.js') is there a way to do remove that script later? sort of like a clean where I say delete the js I loaded earlier

like image 746
twitter Avatar asked Feb 24 '11 17:02

twitter


1 Answers

getScript doesn't "load" a script in the sense of keeping it around; it downloads the script from the server and runs it immediately. So there's no need to remove it.

However, any DOM objects that the script creates, or functions it defines, etc., will continue to exist. Removing these will require knowing specifically what they are; probably your best bet is to have your script define a function that deletes all of the things that the rest of the script creates.

like image 167
Jacob Mattison Avatar answered Sep 20 '22 23:09

Jacob Mattison