老师 您好 帮我看看效果吧

来源:3-4 自由编程

小虾虾小

2019-11-19 09:15:41

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>Document3-4</title>

    <style type="text/css">

        .box{

            width: 200px;

            height: 200px;

            background-color: pink;

        }

        .box-inner{

            width: 80px;

            height: 80px;

            background-color: lightblue;

        }

    </style>

</head>

<body>

    <button id="btn">点击这里!</button>

    <div class="box" id="box">

        <!-- <div class="box-inner">我是smallbox内容</div> -->

    </div>

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

    <script>

        $('#btn').on('click',function(){

            $('#box').append('<div class="box-inner">我是smallbox内容</div>');


            $('.box-inner').on('click',function(){

                alert('已执行');

            });

        });

    </script>

</body>

</html>


写回答

1回答

好帮手慕慕子

2019-11-19

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

0

0 学习 · 6815 问题

查看课程