Remove script from memory
default.html
- <div id="content"></div>
- <script language="javascript" type="text/javascript" charset="utf-8">
- $(document).ready(function() { $("#content").load("include1.html"); });
- </script>
include1.html
- include 1<br />
- <span onclick="alertMsg()">click to alert</span><br />
- <span onclick="loading()">load new page</span>
- <script>
- function alertMsg() { alert("ok"); }
- function loading() { $("#content").empty(); $("#content").load("include2.html"); }
- </script>
include2.html
- include 2<br />
- <span onclick="alertMsg()">test function alertMsg</span>
when i call default.html, load include1.html and your scripts, function alertMsg() works
i click "load new page" and script empty the div and load a new page on the same div
problem is, when load include2.html, the script loaded in include1.html still exist, there is a way to remove scripts loaded in include1 before load a new page on the div?
tks