It is going to be difficult to find reason for this reading tutorials (or googling) so I ask here. Why does not javascript function change the <p> text if the submit button is inside the form but it does work if I move the button outside the form. The text appears but disappears quickly. Seems like the form is somehow updated after change again. See code below (so this code is not working).

HTML Code:
function showText()
	document.getElementById("mytext").innerHTML = "Hello world";


<form id="frm1">

<p id="mytext"></p>

<button onclick="showText()">Try it</button>