HomeBlogReplace HTML button with text/code when clicked in JS ?Problem and SolutionsReplace HTML button with text/code when clicked in JS ?By M.K. Verma · 3 May 2022 function ReplaceButton() { node = document.getElementById("MyButton") node.insertAdjacentHTML("afterend", "<p>Some text</p>") node.style.display = "none" }Share this:CommentsLeave a commentPost