title: Email validation using Javascript doesn't work with HTML
body: <p>I'm trying to let user check if his email adress pass RFC standard, comparing it with regular expression dropped below.</p>
  <p>I already checked few examples on console using function responsible for excecute validation test. I'm aware of possibilities that my regex is not ready for, but whenever I tried a few examples on console - it works.</p>
  <p>Problem begins when function gets value from included 'text' HTML form.</p>
  <p>Using Javascript I also checked how value is interpretated by browser (Simply pasting text into another div) - result is ok.</p>
  <p>Why validation doesn't work properly whenever use input value on HTML forms?</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>const regular = /^[a-z/d]+[/d/w.-]*@(?:[a-z/d-]+[a-z/d-]\.+){1,5}[a-z]{1,3}[a-z]$/i;
  test = function(email) {
      if (regular.test(email) == false) {
          alert('Your email adress is not correct. Try again!')
          document.getElementById('result').innerHTML = document.getElementById('text').value;
          return false;
      } else {
          alert('Match');
          return true;
      }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id='form-structure'&gt;
     &lt;form name='form1' action='#'&gt;
        &lt;label for='email' name='email'&gt;E-mail&lt;/label&gt;
        &lt;input type='text' name='text' id='text' placeholder="Enter your email" required&gt;
        &lt;button type='submit' name='submit' onclick="test(document.form1.text)" 
           value='Submit'&gt;Test&lt;/button&gt;
     &lt;/form&gt;
  &lt;/div&gt;
  &lt;div id='result' style='font-size: 15px'&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>