jQuery inserts prepend() and prependTo()
The method of operating inside the element, in addition to inserting the specified content at the end of the selected element (still inside) through append and appendTo, can also be inserted before the selected element. The methods provided by jQuery are prepend and prependTo
Description of the selector:
Let’s write an example to explain. The code is as follows:
prepend与prependTo
- php 中文网
- php.cn
Note: prepend( ) and .prependTo() implement the same function. The main difference is the syntax, the inserted content and the location of the target.
Here is a summary of the differences between the four internal operation methods:
append( ) Append content to each matching element
prepend() Prepend content to each matching element
appendTo() Append all matching elements to another specified element In the collection
prependTo() prepends all matching elements to another specified element collection