jQuery Intro

jQuery Intro Quiz

jQuery Intro Exercise

jQuery Basic

jQuery Basic Quiz

jQuery Basic Exercise

jQuery Advance

jQuery Advance Quiz

jQuery Advance Exercise

jQuery Selectors

jQuery Effects

jQuery Events

jQuery Methods and Properties

jQuery Traversing

jQuery CSS and HTML Methods

jQuery html() Method

jQuery html() Method



The html() method is used to set or return the content with tags of the selected elements.


For your Information:-


  1. When it is used to set content, it will overwrite the content of ALL matched elements.
  2. When it is used to return content, it returns the content of the FIRST matched element.


To return or set only the text content, we can use the text() method.




Its syntax is:- $(selector).html(content) OR $(selector).html(function(index, currentcontent))


Further Explanation:-


Parameter Description
content Required. Specifies the new content for the selected elements.
function(index,currentcontent) Optional. Specifies a function that returns the new content for the selected elements
  • index - Returns the index position of the element in the set
  • currentcontent - Returns the current HTML content of the selected element

Code Explanation

All Tutorials related to jQuery CSS and HTML Methods

All Sections related to jQuery