The text( ) method gets the combined text contents of all matched elements. This method works for both on XML and XHTML documents.
Here is the simple syntax to use this method −
Here is the description of all the parameters used by this method −
Following example would find the text in the first paragraph stripping out the html, then set the html of the second paragraph to show it is just text.
This will produce following result −