老师,请检查

来源:3-4 自由编程

爱吃鸡爪爪

2020-04-09 13:57:47

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Document</title>

<style type="text/css">

#container {

height: 300px;

width: 300px;

background: pink;

}

.smallbox {

height: 100px;

width: 100px;

background: lightblue;

}

</style>

</head>

<body>

<button type="button">点击这里</button>

<div id="container">


</div>

<script src="https://cdn.bootcss.com/zepto/1.1.7/zepto.min.js"></script>

<script>

/*此处写代码*/

var $cr = $("<div>我是smallbox内容</div>");

$("button").on("click",function(){

$('#container').append($cr);

$('#container > div').addClass("smallbox");

$('#container > div').on('click',function(){

alert("已执行");

});

});

</script>

</body>

</html>


写回答

1回答

好帮手慕糖

2020-04-09

同学你好,代码是正确的,继续加油。祝学习愉快~

0

0 学习 · 6815 问题

查看课程

相似问题