title: jQuery Validate custom rule for comparing two properties not equal by ID
body: <p>I need to compare two input text fields of a form using a custom rule for jQuery Validate.</p>
  
  <p>I tried the following code</p>
  
  <pre><code>//Our validation script will go here.
  
  $(document).ready(function(){
       //custom validation rule - text only
       $.validator.addMethod("NotEqualTo", 
               function(value, element) {
                   return ???;
               }, "Two Properties are matching"
      );
  
      $("#frmUpdatePassword").validate({
          onfocusout: true,
          rules: {
              NewPassword: {
                  NotEqualTo: '#OldPassword'                }
          },
          messages: {
              NewPassword: {
                  NotEqualTo: "Two Properties are having same values"
              }
          }
      });
  });
  </code></pre>
  
  <p>The HTML <code>TextBox</code> is</p>
  
  <pre><code>&lt;input type="password" id="OldPassword" name="OldPassword" /&gt;
  &lt;input type="password" id="NewPassword" name="NewPassword" /&gt;
  </code></pre>
  
  <p>Kindly assist me how to compare for not equal of two properties in a generic manner not only for comparing these two fields.</p>