父页面代码:
父页面触发弹窗的js代码:
子页面的关闭的js代码:
问题:子页面的js没有加载进来。
请问你的 jQuery
版本是多少?
根据你的描述, 我写了以下的测试页面, 但并没有发现 有问题呀?
演示地址: https://xqin.net/temp/jquery.load/1.html (不保证长期有效)
代码如下:1.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
.sc-model{
width: 300px;
height: 300px;
border: 1px solid #ccc;
}
</style>
</head>
<body>
<div class="sc-model"></div>
<input type="button" id="test" value="load" />
<script type="text/javascript" src="http://cdn.bootcss.com/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$('#test').click(function(){
$('.sc-model').show().load('2.html');
});
</script>
</body>
</html>
2.html
<h2>这里是2.html中的内容</h2>
<input type="button" value="关闭" class="model-close" />
<script type="text/javascript">
$('.model-close').click(function(){
$('.sc-model').fadeOut().html('');
});
</script>