I'm assuming script.js has some methods you're using after your event has fired. You could take these methods and place them inside an object and instantiate the object onclick, instead of loading the *.js file. Then, to remove it, just set that object to null. I'm borrowing from greater minds than my own of course, Rebecca Murphy has a great writeup on the subject. She focuses on code organization, but moving code into "objects" gives you a little more power and might make what you're looking into a bit easier.
↧