title: Set custom HTML5 required field validation message
body: <h1>Required field custom validation</h1>
  
  <p>I have one form with many input fields. I have put html5 validations</p>
  
  <pre><code>&lt;input type="text" name="topicName" id="topicName" required /&gt;
  </code></pre>
  
  <p>when I submit the form without filling this textbox it shows default message like</p>
  
  <p><code>"Please fill out this field"</code></p>
  
  <p>Can anyone please help me to edit this message?</p>
  
  <p>I have a javascript code to edit it, but it's not working</p>
  
  <pre><code>$(document).ready(function() {
      var elements = document.getElementsByName("topicName");
      for (var i = 0; i &lt; elements.length; i++) {
          elements[i].oninvalid = function(e) {
              e.target.setCustomValidity("");
              if (!e.target.validity.valid) {
                  e.target.setCustomValidity("Please enter Room Topic Title");
              }
          };
          elements[i].oninput = function(e) {
              e.target.setCustomValidity("");
          };
      }
  })
  </code></pre>
  
  <p><br></p>
  
  <h1>Email custom validations</h1>
  
  <p>I have following HTML form</p>
  
  <pre><code>&lt;form id="myform"&gt;
      &lt;input id="email" name="email" type="email" /&gt;
      &lt;input type="submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><br>Validation messages I want like.</p>
  
  <p><strong>Required field:</strong> Please Enter Email Address<br>
  <strong>Wrong Email:</strong> 'testing@.com' is not a Valid Email Address. (<em>here, entered email address displayed in textbox</em>)</p>
  
  <p>I have tried this.</p>
  
  <pre><code>function check(input) {  
      if(input.validity.typeMismatch){  
          input.setCustomValidity("'" + input.value + "' is not a Valid Email Address.");  
      }  
      else {  
          input.setCustomValidity("");  
      }                 
  }  
  </code></pre>
  
  <p>This function is not working properly, Do you have any other way to do this? It would be appreciated.</p>