title: Form Validation using JavaScript?
body: <p>I'm trying to use form validation using JavaScript, however I don't seem to get any response, not even an alert even though it's there.</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  
      &lt;head&gt;
          &lt;title&gt;Example Form&lt;/title&gt;
          &lt;script type="text/javascript"&gt;
              function CheckForBlank() {
  
                  if(document.getElementById('name').value="") {
                      alert("enter something valid");
                      return false;
                  }
              }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
  
          &lt;form method="post" action="2013.php" onsubmit="return CheckForBlank();"&gt;
              Name: &lt;input type="text" name="name" id="name"/&gt;
              Age: &lt;input type="text" name="age" id="age"/&gt;
              Email: &lt;input type="text" name="email" id="email"/&gt;
              &lt;p&gt;&lt;input type="submit" value="Submit" /&gt;&lt;/p&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>