This article describes the usage of the prependTo () method in jQuery. The example analyzes the functions, definitions, and usage tips of the prependTo () method before inserting matching elements into a specified element, for more information about how to use the prependTo () method in jQuery, see the following example. Share it with you for your reference. The specific analysis is as follows:
This method inserts the matched element before the specified element.
The prependTo () method has the same role as the prepend () method, but its syntax is different, although it looks the same in form.
Syntax structure:
The code is as follows:
$ (Selector). prependTo (content)
Parameter list:
| Parameters |
Description |
| Selector |
The matching element to be inserted. |
| Content |
Element to be inserted with matching elements. |
Instance code:
The code is as follows:
PrependTo () function-script House