Skip to main content

Bug Tracker

Side navigation

Ticket #5018: test.html
File test.html, 0.9 KB (added by keithpitt, August 06, 2009 07:24AM UTC)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<script type="text/javascript" src="jquery-1.3.2.js"></script>
	<script type="text/javascript">
	  function someMethod() {
        $('#stale').html('Smelly');
		console.log("But I am being called.");
	  }
	  function replaceContent() {
		$('#test').replaceWith("<div id='text'><div id='stale'></div><script type='text/javascript'>$(document).ready(function() { someMethod(); });<" + "/script></div>");
	  }
	</script>
  </head>
  <body>
  	<div id="test">
      <div id="stale"></div>
	  <script type="text/javascript">
	    $(document).ready(function() {
		   someMethod();
	    });
	  </script>
	</div>
	<button onclick="replaceContent(); return false;">Break</button>
  </body>
</html>

Download in other formats:

Original Format