诚意
诚意如你,当一诚的态度对待

导航

 

一:效果

代码:

 1 <!DOCTYPE html>
 2 <html lang="zh-CN">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>Title</title>
 6     <meta name="viewport" content="width=device-width, initial-scale=1">
 7     <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
 8 
 9 </head>
10 <body>
11 
12 <div class="outer">
13     <div class="item">
14         <button class="add">+</button><input type="text">
15     </div>
16 
17 
18 </div>
19 
20 <script>
21 
22    $(".add").click(function () {
23        let clone=$(this).parent().clone();
24        clone.children(".add").attr("class","rem").html("-");
25        $(".outer").append(clone)
26 
27    });
28 
29     $(".outer").on("click","button.rem",function () {
30         $(this).parent().remove()
31     })
32 
33 
34 </script>
35 </body>
36 </html>
View Code

 

posted on 2018-11-08 19:29  诚意  阅读(128)  评论(0)    收藏  举报