Get the contents of all matching elements: The result is text that is combined with the text content contained by all matching elements, which is valid for both HTML and XML documents, equivalent to the innertext attribute in JavaScript, readable and writable, but unable to parse the HTML tag:
If callback is passed in, this function returns a string and the parameters are resolved as follows:
1.index is the index position of the element in the collection
2.text is the original text value.
Instance:
<! DOCTYPE html>Div{font:25px/250px ' Courier New '; Text-align:center;color: #000; border:1px solid #F50; width:700px;height:250px;margin : 20px Auto;} . addone{padding:08px;} . addtwo{color:#999;}</style><script type= ' Text/javascript ' > $(function() {alert ($ (' #user '). text ()); $(' #user '). Text (function(index,oldtext) {returnOldText + ' <strong>this is a test</strong> '; }); });</script>
[jquery method Text ([VAL|FN])] This method operates on a matching element or content in an element set, equivalent to the innertext attribute in JavaScript