标签:
克隆--clone()
追加--append()
移除--remove()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | < div id = "search_conditions" > < div class = "condition" > < a onclick = "AddCondition(this,‘#search_conditions‘)" >+</ a > < input /> </ div > </ div > < script src = "../js/jquery-2.1.4.min.js" ></ script > < script type = "text/javascript" > function AddCondition(ths,container){ //克隆condition整个div //再把克隆的div追加到search_conditions下面 var cp = $(ths).parent().clone(); cp.children(‘:first‘).text(‘-‘).attr(‘onclick‘,‘RemoveCondition(this,"#search_conditions")‘); $(container).append(cp); // cp.appendTo(container) } function RemoveCondition(ths,container){ $(ths).parent().remove(); } </ script > |
视频:D16--jQuery文档处理
课件:cmdb_plugin/demo_2.html
标签:
原文地址:http://www.cnblogs.com/daliangtou/p/5236375.html