There are two pages ,Add part of webform4.html’s page content into webform3.html’s div after webform3.html load completed.But when I click the Buttone4,the event do not work.
How to fix this?Thank you very much!
WebForm3.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script src="scripts/jquery-1.7.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#W4").load("WebForm4.html #CC");
$("#Button4").click(function () {
alert("webform4.html");
})
})
</script>
</head>
<body>
<form>
<div id="W4">
</div>
<input id="Button1" type="button" value="button" />
</form>
</body>
</html>
WebForm4.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div id="CC">
<input id="Button4" type="button" value="button"/>
</div>
</body>
</html>
Attach your event handler with
delegate()or attach it after the load is complete in the callback: