You'll need a record of every function and variable that a script defines. Perhaps a function that does the "clean up". For instance (untested):
var blah = 3; var blahblah = { 'f': 12 }; function aFunc() { }; function aFunc2() { } function cleanUp() { blah = undefined; blahblah = undefined; aFunc = undefined; aFunc2 = undefined; } Karl Rudd On Mon, Apr 7, 2008 at 7:19 PM, Virendra <[EMAIL PROTECTED]> wrote: > > i want to remove all the functions and variables that the script > defines. > > On Apr 4, 12:08 am, hj <[EMAIL PROTECTED]> wrote: > > > I have added a js file in my html file. > > > <script src="test.js" language="JavaScript"></script> > > > > > I want to remove the script from my file using jQuery. > > > I have tried using the following > > > jQuery('script[src="test.js"]').remove(); > > > But the script is not getting removed. > > > > Do you want to remove the script, or the functions and variables > > that it defines? To remove the script element, try: > > > > jQuery('script[src*=test.js]').remove(); > > > > But that will only remove the element from the DOM; all the functions > > and variables it defines will still exists. > > > > -- > > > > hj >