Remove script from memory

Remove script from memory

default.html
  1. <div id="content"></div> 
  2. <script language="javascript" type="text/javascript" charset="utf-8">
  3. $(document).ready(function() { $("#content").load("include1.html"); });
  4. </script>

include1.html
  1. include 1<br />
  2. <span onclick="alertMsg()">click to alert</span><br />
  3. <span onclick="loading()">load new page</span>

  4. <script>
  5. function alertMsg() { alert("ok"); }
  6. function loading() { $("#content").empty(); $("#content").load("include2.html"); }
  7. </script>

include2.html
  1. include 2<br />
  2. <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