title: jQuery form validation without a plugin
body: <p>I am new to jQuery and am looking to do a simple form validation. So if the value of the specified text field is a blank string, I would like the related div elements to show.</p>
  
  <p>My HTML and jQuery so far are below, any help would be awesome.</p>
  
  <pre><code>&lt;form id="frm"&gt;
      &lt;p&gt;Please enter your name&lt;/p&gt;
      &lt;input type="text" id="txtname" autofocus &gt;
      &lt;span id="msg_name"&gt;&lt;/span&gt;
  
      &lt;p&gt;Please enter your surname&lt;/p&gt;
      &lt;input type="text" id="txtsurname" &gt; &lt;span id="msg_surname"&gt;&lt;/span&gt;
  
      &lt;input type="submit" id="send" value="Submit"&gt;
  &lt;/form&gt;
  
  $(document).ready(function() {  
      $("#frm").submit(function(event) {      
          var vname = $("#txtname").val(),
              vsurname = $("#txtsurname").val();      
  
          if(vname == "") {           
              $("#msg_name").text("Please fill this out");
              event.preventDefault();         
          } else if (vsurname == "") {                
              $("#msg_surname").text("Please fill this out");
              event.preventDefault();
          }       
      });
  });
  </code></pre>