version added: 1.0.text(). This method does not accept any arguments. Unlike the . html() method, .text() can be used in both XML and HTML documents.As of jQuery 1.4, the .text() method returns the value of text and CDATA nodes as well as element nodes. With jQuery you can add and remove HTML elements on a page, and modify their content. Adding New Elements.As you can notice, if you click the button bellow, when you get a content with text(), it removes the tags. When you add a HTML, the element will contain and display the entire content Note that, this will return HTML code, not the formatted text. The example below makes it clearer. Getting jQuery inner html example.You can use .html method to set or add HTML content to the specified elements. Adding element to
("div" nextindex).append("nbspRelated Post. How to embed jQuery into HTML page. How to Auto populate dropdown with jQuery AJAX. Delete multiple selected records with jQuery and A More "jquery add text to element" pdf.jQuery Essentials by Marc Grabanski.