Total Page Preview:   000000000230

what is jQuery html()?

 jQuery html()

In jQuery, the html() method is used to get or set the HTML contents of the selected elements. Here's a brief explanation of its usage:

Get HTML Content:
  • This code retrieves the HTML content of the first element matched by the selector and stores it in the content variable.
Set HTML Content:
  • This code sets the HTML content of all elements matched by the selector to the specified string, in this case, "new HTML content".
Example:
In this example, the initial content of the div element with the ID "example" is "Original Content". The script first retrieves this content using html() and logs it to the console. Then, it sets the HTML content of the same element to "New Content". You can see the changes when you inspect the page.
 
 
 
 
 

Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com



Comments