title: Using onclick event inside input tags in HTML to call a Javacscript function
body: <p>Is it possible in HTML to insert "onclick="function()" " like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="submit"  name="subm" id="sub" value="Submit" onclick="js()" /&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>After this submit button is pressed I want to call the function js() which is included in the script. This function makes a control if one of my input fields with "tel" id contains characters or not.After submitting the form nothing outputs. Can someone help with this code so it can output the message inside the js()  function.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script&gt;
    var a=getElementById("tel");
  //tel is the id of a input field
  function js(){
    
  if((a.search(/[a-zA-Z]*/))!=-1){
   document.writeln("Tel nr mustn't contain charachters");
  }
  else document.writeln("The tel number is Ok");
  
  }
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>