jquery的clon
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="jquery-3.1.1.js"></script> </head> <body> <div id="tianjiaclon"> <div id="ddddd"> <input type="button" value="+" onclick="f(this)"> <input type="text"> </div> </div> </body> <script> function f(self) { var s = $(self).parent().clone(); //获取到this的点击事件后,返回父标签,进行clon //把clon出来的标签的"+"号变为"-"号 s.children(":button").val("-").attr("onclick","f1(this)"); $("#tianjiaclon").append(s); //把clon的信息添加到,最外层的div标签中 } function f1(self) { //点击"-"号把clon当前对象删除 $(self).parent().remove(); } </script> </html>
相关推荐
84483065 2020-09-11
85477104 2020-08-15
83510998 2020-08-08
tztzyzyz 2020-07-05
delmarks 2020-06-28
89510194 2020-06-27
牵手白首 2020-06-14
tztzyzyz 2020-05-31
81463166 2020-05-17
delmarks 2020-05-17
donghongbz 2020-05-15
tztzyzyz 2020-05-15
<table id="table" class="table table-striped table-bordered table-hover table-nowrap" width="100%&qu
牵手白首 2020-05-14
Chriswang 2020-04-30
83510998 2020-05-03
89463661 2020-04-25