jQuery add() Method
-- Learning not just technology, but dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
jQuery Tutorial
jQuery Tutorial jQuery Introduction jQuery Installation jQuery Syntax jQuery Selectors jQuery Events
jQuery Effects
jQuery Hide/Show jQuery Fading jQuery Sliding jQuery Animation jQuery Stop Animation jQuery Callback jQuery Chaining
jQuery HTML
jQuery Get jQuery Set jQuery Add Elements jQuery Remove Elements jQuery CSS Classes jQuery css() Method jQuery Dimensions
jQuery Traversing
jQuery Traversing jQuery Ancestors jQuery Descendants jQuery Siblings jQuery Filtering
jQuery Ajax
jQuery AJAX Introduction jQuery load() Method jQuery get()/post() Methods
jQuery Other
jQuery noConflict() Method jQuery JSONP
jQuery Examples
jQuery Reference
jQuery Selectors jQuery Event Methods jQuery Effects Methods jQuery HTML / CSS Methods jQuery Traversing Methods jQuery AJAX Methods jQuery Miscellaneous Methods jQuery Properties
jQuery Plugins
jQuery Validate jQuery Cookie jQuery Accordion jQuery Autocomplete jQuery Growl jQuery Password Validation jQuery Prettydate jQuery Tooltip jQuery Treeview
jQuery add() Method
Example
Add the <p> and <span> elements to an existing element set (<h1>):
$("h1").add("p").add("span")
Definition and Usage
The add() method adds elements to an existing set of elements.
The method adds elements to the entire document if no context parameter is specified. If a context parameter is specified, the elements are added only within the context element.
Syntax
$(selector).add(element,context)
| Parameter | Description |
|---|---|
| element | Required. Specifies the selector expression, jQuery object, one or more elements, or an HTML fragment to add to the existing set of elements. |
| context | Optional. Specifies the point in the document where the selector expression should start matching. |
More Examples
Add <span> elements to an existing set of <p> elements by using a DOM element reference.
Use an HTML fragment to add <span> elements to existing <p> elements.
ByteDance Coding Plan supports mainstream large models like Doubao, GLM, DeepSeek, Kimi, MiniMax, officially supplied, stable and reliable.
Xunfei Star Coding Plan includes free model call quotas, DeepSeek, GLM, Kimi, MiniMax, one-stop experience and deployment platform. Configuration Guide Β₯3.9/month Subscribe Now
Click to Share Notes
Write notes...
Image URL
Image description
Share notes
- Nickname (required)
- Email (required)
- Reference URL
YouTip