Set Content: It is used to set the content using jQuery. The following methods are used to set the content which are listed below:
- text(): It is used to set or return the text content of selected elements.
- html(): It is used to set or return the innerHTML content of the selected element.
- val(): This parameter is used to set or return the value of attribute for the selected elements. This method apply on the HTML form elements.
Example: This example uses set content method (text(), html() and val() method) to set the content.
- Before Click on the button:
- After Click on the Set 1 line button:
- After Click on Set 2 line button:
- After Click on Set 3 line button:
Set Attributes: The jQuery attr() method in jQuery is used to set and change attribute values.
Example: This example uses attr() method to set and change attribute values.
- Before click on link:
- Click on link before click on button:
- Click on link after click on button:
- jQuery | Get Content and Attributes
- How to copy the content of a div into another div using jQuery ?
- How to insert HTML content into an iFrame using jQuery?
- Content editable change event in jQuery
- JQuery | Detect a textbox content is changed or not
- How to detect and change the content/style of a div using jQuery ?
- How to check a selector matches some content using jQuery?
- XML | Attributes
- HTML | Id Attributes
- HTML | Attributes
- HTML | data-* Attributes
- PHP | SimpleXMLElement attributes() Function
- HTML | DOM attributes Property
- HTML | Attributes Complete Reference
- Tags vs Elements vs Attributes in HTML
- Perl - Attributes in Object Oriented Programming
- Data-toggle attributes in Twitter Bootstrap
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.