How To Replace innerHTML of Div Using jQuery

WebSolutionStuff | Jul-08-2022 | Categories : jQuery

In this article, we will see how to replace the innerHTML of div using jquery. We can use html() method to replace the innerHTML of the div or any other HTML element. The html() method sets or returns the content (innerHTML) of the selected elements.

So, let's see how to replace html of div using jquery, jquery replace html in div, how to add html in div using jquery, how to change div text in jquery, jquery replace innerHTML, jquery get innerHTML, jquery replace html.

The jQuery code in the following example will replace the innerHTML of a DIV element having id changeTextDiv with an HTML heading on click of the button.

<!DOCTYPE html>
<html lang="en">
<title>How To Replace innerHTML of Div Using jQuery - Websolutionstuff</title>
<script src=""></script>
        $("#changeTextDiv").html("<h1>Hello, World!</h1>");
    <div id="changeTextDiv">
        <p><b>Click the following button to replace me.</b><p>
    <button type="button" id="changeTextBtn">Replace HTML</button>


You might also like:

Recommended Post

Featured Post

Follow us
facebooklogo github instagram twitter

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock or some other adblocking software which is preventing the page from fully loading.

We need money to operate the site, and almost all of it comes from our online advertising.

Please add websolutionstuff to your ad blocking whitelist or disable your adblocking software.