老师,请帮忙检查下
来源:3-4 自由编程
Grayson_liu
2020-04-24 20:41:52
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="zepto.js"></script>
<style>
.outerBox{
background:pink;
width:400px;
height:400px;
}
.smallbox {
width:100px;
height:100px;
background:#87ceeb;
}
</style>
</head>
<body>
<p id="btn">点击这里</p>
<div class="outerBox"></div>
<script>
$(document).ready(function(){
$('#btn').on('click', function(){
var smallBox = '<div>我是smallbox内容</div>';
$(this).next().append(smallBox);
$('div > div').attr('class','smallbox').on('click', function(){
alert('已执行');
});
});
});
</script>
</body>
</html>1回答
好帮手慕糖
2020-04-25
同学你好,代码是正确的。继续加油,祝学习愉快!