When reading the following code, we will find that all the Dom operation functions call the domManip function append: function () {returnthis. domManip (arguments, true, 1, function (a) {this. appendChild (a) ;}) ;}, prepend: fun...
When reading the following code, we will find that all the Dom operation functions call the domManip function.
Append: function (){
Return this. domManip (arguments, true, 1, function (){
This. appendChild ();
});
},
Prepend: function (){
Return this. domManip (arguments, true,-1, function (){
This. insertBefore (a, this. firstChild );
});
},
Before: function (){
Return this. domManip (arguments, false, 1, function (){
This. parentNode. insertBefore (a, this );
});
},
After: function (){
Return this. domManip (arguments, false,-1, function (){
This. parentNode. insertBefore (a, this. nextSibling );
});
},
What is the use of this domManip function?
Dom is the Dom element, and Manip is the abbreviation of Manipulate. Joining together means Dom operations.
Let's take a look at the following code. The code itself is very simple: Insert a row and a column in the table and write the text haha.