title: Validate extension of a form input type url
body: <p>i'm working on a form where you can put your logo as url. I know how to validate a file extension but not a string from a form. i've started with the code i've mentioned here but im totally lost.</p>
  
  <pre><code>&lt;script&gt;
  $('#editForm_Submit').click(function (e) {
      e.preventDefault();
      var re = /^[A-Za-z]+$/;
      if(re.test(document.getElementById("LogoUrl").value))
          alert('Valid Name.');
      else
          alert('Invalid Name.');
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>It has to preventdefault and check the extention on jpg,png and jpeg.
  if validate than submit else return false.</p>
  
  <p>I've also tried</p>
  
  <pre><code>&lt;script&gt;
  jQuery(document).ready(function () {
      $('#editForm_Submit').click(function (e) {
          e.preventDefault();
          jQuery("input[type=url]").each(function () {
              jQuery(this).rules("add", {
                  accept: "png|jpe?g",
                  messages: {
                      accept: "Only jpeg, jpg or png images"
                  }
              });
          });
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>I know how to do it with php but i want to try it with javascript or jquery</p>