Jquery HTML()

JQuery is a javascript library that makes working javascript fun and easy. It has in-built libraries for manipulating HTML elements and attributes and this is done through html() method.

The syntax of html() method in Jquery is:

Changing HTML Content

$(selector).html(content)

Jquery html() makes use of Jquery innerhtml to perform its operation.

Look at the example below:

$(document).ready(function(){
$(".mydiv").html("Hello World!");
});

This is a test.

Jquery html() method would change "This is a test" in .mydiv to "Hello World!" on loading.

Similarly, you can use other html() method functions like append, prepend, after, before to manipulate html content for whom snytax is:

$(selector).append(content)
$(selector).prepend(content)
$(selector).after(content)
$(selector).before(content)

Make a Donation to support the site




User login

Navigation