title: Why jQuery validation is not fired when addMethod is called within an object method?
body: <p>I have this cute class: </p>
  
  <p><strong>validations.js</strong></p>
  
  <pre><code>var Validation = function () {
  
      var load= function () {
  
          $.validator.addMethod("noweirdstuff", function (value, element) {
              return !(/\W/.test(value));}, "Username has invalid characters. Only letters, numbres &amp; underscores allowed.");
  
          $.validator.unobtrusive.adapters.add("noweirdstuff", function (options) {
              options.rules["noweirdstuff"] = true;
              if (options.message) { options.messages["noweirdstuff"] = options.message;}
          });   
      }
  
      return {
          init: function () {
              load();
          }
      };
  
  }();
  </code></pre>
  
  <p><strong>validations.js</strong> is bundled and minified with all javascript code into single file. Then, I'm using per page script to load only required code. In this case:</p>
  
  <pre><code>Validation.init(); 
  </code></pre>
  
  <p>But it doesn't seem fire the validation. I'm 100% sure that <code>Validation.init()</code> is being called.</p>
  
  <p>It only works when I take it outside:</p>
  
  <p><strong>validations.js</strong></p>
  
  <pre><code> var Validation = function () {
  
          var load = function () {  
           // goodbye adding validation         
          }
  
          return {
              init: function () {
                  load();
              }
          };
  
   }();
  
   $.validator.addMethod("noweirdstuff", function (value, element) {
                          return !(/\W/.test(value));}, "Username has invalid characters. Only letters, numbres &amp; underscores allowed.");
  
   $.validator.unobtrusive.adapters.add("noweirdstuff", function (options) {
                          options.rules["noweirdstuff"] = true;
                          if (options.message) { options.messages["noweirdstuff"] = options.message;}
                      });
  </code></pre>
  
  <p>Why?</p>