Hi All
Hope this jquery based simple code will help to explain the issue.
html:
<script>
$('#remover').click(function(){
$('#block').empty();
})
$('#test').click(function(){
alert(remove1); // still displays the varibale
})
</script>
<div id="block">
<script>
var remove1 = 'asasdsds';
var remove2 = 'asasdsds';
var remove3 = 'assdsdsdas';
var blabla = 'blablabl';
</script>
</div>
<span id="remover">Remove ALL</span>
<span id="test">Test</span> // it will still displays the variable.
I need to clear all variables from global scope by removing the block content. The block content is dynamic and can contain any javascript code.
Thanks for reading.