title: How can I add additional method to validate NIC number in jQuery?
body: <p>I used jquery validation plugin to validate my form but in one text box I want to validate the NIC(National Identity Card) number of our country .I got the regular expression for NIC number can anyone tell me how to add additional method to validate this .</p>
  
  <p>reqular expression for NIC number : <code>/^[0-9]{9}[vVxX]$/</code>
  textbox id : <code>showNic</code></p>
  
  <p>here is my jQuery code...</p>
  
  <pre><code>$(document).ready(function () {
      jQuery.validator.setDefaults({
          // where to display the error relative to the element
          errorPlacement: function (error, element) {
              error.appendTo(element.parent().find('div.myErrors'));
          }
      });
      $('#basicDetails').validate({ // initialize the Plugin
          rules: {
              fname: {
                  required: true,
                  lettersonly: true,
              },
              lname: {
                  required: true,
                  lettersonly: true,
              },
          },
          messages: {
              fname: {
                  required: "Please enter your first name",
                  lettersonly: "Login format not valid",
              },
              lname: {
                  required: "Please enter your last name",
                  lettersonly: "Login format not valid",
              },
          },
          submitHandler: function (form) { // for demo
              alert('valid form submitted'); // for demo
              return false; // for demo
          }
      });
  });
  </code></pre>