1, append ()-Inserts the content at the end of the selected element (the end of the content, for example , a tag, which isadded before the </a> the tag) .
2, prepend ()-Insert the content at the beginning of the selected element (the beginning of the content, for example , a tag, thenadd something after the < a> the tag)
3,after ()-insert the content after the selected element (the end of the element, for example , there is a tag, then the </a> the label after the addition of things)
4,before ()-Insert the content before the selected element (the beginning of the content, for example, there is a tag, then the <a> the tag before adding something)
So we often use the table element to add, generally with apend and prepend, because it is before the </table> tag.
For example, BTN1 and Btn3 two buttons, two tables, not uploaded nouploaded and uploaded uploaded. If the list is not uploaded, one row or a few rows, press BTN1, then move the rows of data to the uploaded table.
In the uploaded table, select one or more rows, press BTN3, and move a few rows of data to the non-uploaded table.
$ (document). Ready (function () {
$ ("#btn1"). On ("click", Function () {
$ (' #nouploaded tbody:checked '). Parents (' tr '). AppendTo (' #uploaded ');
$ ("#nouploaded tbody:checked"). Parents (' tr '). Remove ();
})
$ ("#btn3"). On ("click", Function () {
$ (' #uploaded tbody:checked '). Parents (' tr '). AppendTo (' #nouploaded ');
$ ("#uploaded tbody:checked"). Parents (' tr '). Remove ();
})
})
The difference between append (), prepend (), after (), before () in JQ