JQuery add delete elements

<body>
<
ul><ul/> <div><div>
</body>

 

1. Internal added plus to the relationship between father and son

was added back to prepend append prepend

let li = $ ( "<li > I add an internal </ li>") 
$ ( "ul") the append (li).;

 

2. External Add to add the phrase are brothers

let div = $ ( "<div > I add external </ div>") 
$ ( "div") the before (div).;

3. Removing elements

$ ( "ul"). the Remove ()     // directly delete this element 
$ ( "ul"). empty ()      // delete this element inside the child nodes 
$ ( "ul"). HTML ()        // this with empty the same effect

 

Guess you like

Origin www.cnblogs.com/yanghai/p/11618808.html