I try to write a JavaScript on a html button element. But it will cause the page reload. But when I use input with button type it works just fine. What is the reason for this and why could i can not use button element here?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Default</title>
<script type="text/javascript">
function changeTheText() {
document.getElementById("paragraphText").innerHTML = "The text is changed!";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<p id="paragraphText">This is awesome!</p>
<button onclick="changeTheText()">Change the text</button>
<input type="button" onclick="changeTheText()" value="Click" />
</div>
</form>