Cleaning javascript variable scope by removing it's code from DOM

前端 未结 2 1140
情话喂你
情话喂你 2021-01-22 08:15

Hope this jquery based simple code will help to explain the issue.

html:



        
2条回答
  •  既然无缘
    2021-01-22 09:16

    Javascript doesn't work that way! Once a script block is parsed, removing it from the DOM won't do anything... The only thing I can think of is a really ugly hack like this:

    
    

    Then your remove function looks like:

    
    

提交回复
热议问题