<script>
function appendText() {;
var txt1 = "<p>Text.</p>"; // Create text with HTML
var txt2 = $("<p></p>").text("Text."); // Create text with jQuery
var txt3 = document.createElement("p");
txt3.innerHTML = "Text."; // Create text with DOM
$("body").append(txt1, txt2, txt3); // Append new elements
};
</script>
<body>
<p>This is a paragraph.</p>
<button type="button" onclick="appendText()" class="btn btn-primary mb-5">Append Text</button>
</body>
This is a paragraph.