document.getElementById("p").textContent += "You are now connected;"
function myFunction() {
document.getElementById("p").textContent.replace("You are now connected;", "You are disconnected");
}
<p id ="p"></p>
<button onclick="myFunction()">out</button>
I created some text using Javascript and now I want to change the content of the text after I press a button but I am having difficulties with it.