麻烦老师检查,谢谢
来源:3-4 自由编程
qq_慕移动3101913
2020-03-23 17:03:36
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>属性操作</title> <style> .box{ width: 500px; height: 500px; background-color: pink; } .text{ width: 100px; height: 100px; background-color: blue; } </style> </head> <body> <p id="btn">点击这里!</p> <div id="box" class="box"> </div> <script src="https://cdn.bootcss.com/zepto/1.1.7/zepto.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ var $cr = $("<div class='text'>我是smallbox内容</div>"); // 插入操作 $('#btn').on('click' , function () { $("#box").append($cr); $("#text").attr("class","text"); }); }) </script> </body> </html>
1回答
qq_慕移动3101913
提问者
2020-03-23
此作业有误 无需作答
相似问题