I have the following javascript function that updates a text within a div when a button is clicked (using an onclick() event) It works, but it immediately changes back to th
You are using input type="submit" inside Form tag , clicking this button will refresh the same page .
try
Text to Change
or remove form tag