Get the combined text contents of each element in the set of matched elements or set the text contents of the matched elements.
// <h1>Hello World</h1>
const title = $('h1').text();
"Hello World"
$('h1').text('User input <script>');
<h1>User input <script></h1>
// <li>A</li>
$('li').text((index, text) => `${index}. ${text}`);
<li>0. A</li>
| Parameter | Type | Description |
|---|---|---|
| content | string | function | The text to set, or a function that returns the text. Function receives (index, currentText). |
Returns: A string for getter, or the original SR object for setter.