Manipulate the DOM in jQuery
jQuery provides methods to manipulate the DOM in an extremely efficient way. You do not need to write code that is too long to modify the attribute value of any element or to extract HTML code from a p or div tag.
jQuery provides methods to manipulate the DOM in an extremely efficient way. You do not need to write code that is too long to modify the attribute value of any element or to extract HTML code from a p or div tag.
jQuery provides methods like.attr (), .html (), .val () to retrieve information from DOM elements for later use.
Manipulate content in jQuery
The html () method takes the html content (inside the HTML) of the first matched element.
Here is the syntax of the .html () method:
selector .html( )
For example
The following simple example uses the .html () and .text (val) methods. In it, .html () obtains the HTML content from the object and then the .text (val) method sets the value of the object using the passed parameter.
The jQuery Example