jquery modal dialog and the application clone

Internal Insert: append () appendTo () prepend () prependTo ()

外部插入:after()  before()  insertAfter()  insertBefore()

Replace: $ () replaceWith ().

Delete and empty: remove () to delete the label empty () to empty the contents of a label is reserved

Copy: clone () clone (true)

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


<div class="c1">
    <p>PPP</p>

</div>

<button>add</button>
<script src="jquery-3.1.1.js"></script>
<script>
        $("button").click(function () {
           //$(".c1").append("<h1>HELLO YUAN</h1>")

            var $ele=$("<h1></h1>");
            $ele.html("HELLO WORLD!");
            $ele.css("color","red");

//内部插入
            //$(".c1").append($ele);
            //$ele.appendTo(".c1")
            // $ ( "C1.") The prepend ($ ELE);. 
            // $ ele.prependTo (. "C1") 

// outer insert 
            // . $ (. "C1") After ($ ELE) 
            // $ ele.insertAfter (. "c1") 
            // $ (. "c1"). the before ($ ELE) 
            // $ ele.insertBefore (. "c1") 
// replace 
             // $ ( "the p-"). replaceWith ( ELE $) 

// delete the empty 
            // $ (. "c1"). empty () 
            // $ (. "c1"). the Remove () 

// clone 
//              var $ ele2 = $ (. "c1") .clone (); 
//              $ ( "C1.") After ($ ele2). 
        })
 </ Script > 
</body>
</html>
View Code

 

append

Guess you like

Origin www.cnblogs.com/jintian/p/11109724.html