jQuery DOM Insertion Outside





jQuery text() Method

jQuery text() method is used to set or return the text content of the selected HTMLelements.

Syntax

jQuery text() can be used in both XML and HTML documents. The result of the .text() method is a string containing the combined text of all matched elements.

Note:When this method is used to return content, it returns the text content of all matched HTMLelements .

When this method is used to set content, it overwrites the content of ALL matched HTML elements.

Example

The above jquery text() method example will produce the following output



Try It Now

jQuery DOM Reference

Other Advanced jQuery and DOM topics you might want to learn jQuery Basic DOM Methods

jQuery DOM Removal

jQuery DOM Insertion Inside

jQuery DOM Insertion Outside

jQuery DOM Insertion Around

Sources and Credits

The content and methods in the tutorial has been referred and updated with jQuery API and The jQuery Foundation

Last Updated Jul 21, 2015, 12:00:06 PM