title: How to fix Uncaught TypeError: Cannot read property 'settings' of undefined
body: <p>I was trying to exclude one field for jquery validation but the problem is I encountered such terrible error. My two questions are how exclude one field for JQuery validator and how to fix the <code>Uncaught TypeError: Cannot read property 'settings' of undefined</code> error? </p>
  
  <p>I am using this line of code: <code>$('#datepicker').rules('remove', 'required');</code> because I want to exclude it for validation.</p>
  
  <p>Here's my html code:</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td&gt;Product Code: &lt;br&gt;
      &lt;input disabled type="text" name="product_code_txt" id="product_code_addQty" required /&gt;&lt;/td&gt;
  
      &lt;td&gt;Date Purchased: &lt;br&gt;
      &lt;input type="date" name="date_txt" id="datepicker" class="date_addQty" required /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Here's my Jquery code:</p>
  
  <pre><code>&lt;script&gt;
      $(function() {              
          $('.addQty_link').click(function(){
              var idnum = $(this).attr("value");
              //alert(idnum);
  
              addQuantity(idnum);
  
              function addQuantity(idnum){
                  var addQty_dialog_form, formAddQty;
                  var rules = { txtName: { required: true } };
                  var messages = { txtName: { required: "Please enter name" } };
  
                  $('#datepicker').rules('remove', 'required'); // not working and it has an error 
  
                  $("#addQty-entry-form").validate({
                       rules: rules,
                       messages: messages
                  });
  
                  addQty_dialog_form=$('#dialog-addQty-form').dialog({
                      resizable: false,
                      hide: 'fade',
                      autoOpen: false,
                      width:440,
                      minheight:350,
                      modal: true,
                      open: function(event, ui) {
                        $(this).dialog('widget').position({ my: 'top', at: 'top+120', of: window });
                      },
                      buttons: {
                        "Update": function() {                                        
                            var reg=$("#addQty-entry-form").valid();
                            if(reg==false){
                              $('#addQty-entry-form .submit').click();
                            }
                            else if(reg==true){}
                            },
                            Cancel: function() {
                               addQty_dialog_form.dialog('close');
                            }
                      },
                      close: function() {
                          //formEdit[0].resetForm();
                          $("#addQty-entry-form").trigger("reset");
                          var validator = $( "#addQty-entry-form" ).validate();
                          validator.resetForm();
                      }
                  }).css('overflow','hidden');
  
                  addQty_dialog_form.dialog('open');
  
                  formAddQty = addQty_dialog_form.find( "form" ).on( "submit", function( event ) {
                  event.preventDefault();
                               // addUser();
                  });
                  return false;
              }                       
          });
      }); 
  &lt;/script&gt;
  </code></pre>