title: button in form tag can not call js function
body: <p>i have type button in form. and i am trying to call function onclick event but it wont work.
  there are lot of questions like this but none of them worked for me. my code looks like this</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function reg(event) {
        if(document.getElementById("repass").value !== document.getElementById("pass").value){
          event.preventDefault();
          alert("Passwords do not match");  
        }
      } 
      
  
      function reset() {
        alert("done");
      }
        </code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;form action="../index.ejs" method="post" &gt;
  &lt;div class="registration-popup" id="regpopup"&gt;
    &lt;div class="content"&gt;   
      &lt;h1 id="h1"&gt;Create new account&lt;/h1&gt;
      &lt;div class="input"&gt;
        &lt;input type="text" placeholder="First Name" class="inp"  id="name"/&gt;
      &lt;/div&gt;
      &lt;div class="input"&gt;
        &lt;input type="text" placeholder="Second Name" class="inp" id="secname"/&gt;
      &lt;/div&gt;
      &lt;div class="input"&gt;
        &lt;input type="text" placeholder="Username" class="inp" id="username" /&gt;
      &lt;/div&gt;
      &lt;div class="input"&gt;
          &lt;input type="tel" placeholder="Phone Number" class="inp" id="phone" /&gt;
      &lt;/div&gt;
      &lt;div class="input"&gt;
          &lt;input type="text" placeholder="Address" class="inp" id="addres" /&gt;
      &lt;/div&gt;
      &lt;div class="input"&gt;
        &lt;input type="password" placeholder="Password" class="inp" id="pass" /&gt;
      &lt;/div&gt;
      &lt;div class="input"&gt;
        &lt;input type="password" placeholder="Repeat password" class="inp" id="repass" /&gt;
      &lt;/div&gt;
      &lt;input type="submit" id="register" value="Register" onclick="reg(event)" &gt;
      &lt;input type="button" id="reset" value="Reset" onClick="reset()" &gt;
    &lt;/div&gt;
  &lt;/div&gt;
    &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>when i simply comment out form tags it starts working so issue must be there.</p>