zoukankan      html  css  js  c++  java
  • jQuery Clone方法

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Title</title>
    </head>
    <body>


    <div id="outer">
    <div class="item">
    <input type="button" value="+" onclick="fun1(this)">
    <input type="text">
    </div>
    <div class="item">
    <input type="button" value="-" onclick="fun1(this)">
    <input type="text">
    </div>


    </div>

    <script src="jquery-3.1.1.js"></script>
    <script>
    function fun1(self) {
    var Clone=$(self).parent().clone();
    //Clone.children(":button").val("-").attr("onclick","func2(this)");

    $("#outer").append(Clone)
    }

    function func2(self) {
    alert(123)
    $(self).parent().remove()
    }


    </script>
    </body>
    </html>

  • 相关阅读:
    VueBlog
    java 代理模式
    集合框架
    面试题
    java 多线程
    网络编程
    HTTP
    MAVEN
    Redis高级
    深入浅出--梯度下降法及其实现
  • 原文地址:https://www.cnblogs.com/gerenboke/p/11778240.html
Copyright © 2011-2022 走看看