You can use this method to replace all of the HTML within the selector. Assuming you have an html element like this
<div class="row">
<div class="col-md-12">
<div id="information">
<p>Old message</p>
</div>
</div>
</div>
You could use .html()
. to remove and add an alert or informational text to alert users all with one line.
$("#information").html("<p>This is the new alert!</p>");