Home >Web Front-end >JS Tutorial >Usage examples of add() method in jQuery_jquery
The example in this article describes the usage of the add() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:
This function adds elements matching an expression to the matching elements.
The results returned by the add() function will always be sorted in the order in which the elements appear in the HTML document, rather than simply added.
Grammar:
Grammar 1:
Example:
Example 1:
Add span elements to matching elements and set their font color to green.
I am p
Example 2:
I am p
Grammar 2:
实例:
实例一:
我是p
实例二:
我是p
语法三:
实例:
代码如下:
我是p
希望本文所述对大家的jQuery程序设计有所帮助。