To change the HTML content of an element using jQuery, you can use the html()
method. Here's an example:
HTML:
<div id="myElement">Hello, World!</div>
JavaScript/jQuery:
$(document).ready(function() {
$("#myElement").html("Goodbye, World!");
});
In this example, the jQuery selector $("#myElement")
selects the element with the id myElement
. The html()
method is then used to set the HTML content of the element to "Goodbye, World!".