0

am just don't know what happened it was work correctly .... What's most reasons that led us to this error ???? I was trying to run my website locally then this error comes to me from I don't know so what is this error mean and how can I solve it

the error occurs in this code .... actually , its complete website and I'm a beginner with JS and SO so please help me

 // disable class and attribute rules defined by jquery.validate
    $.validator.classRules = function() {
      return {};
    };


    $.validator.attributeRules = function() {
      return {};
    };
Tareq Arar
  • 77
  • 1
  • 11
  • please follow SO [guidelines](http://stackoverflow.com/help/how-to-ask) and post some code so that others can help you. – Wild Widow May 30 '16 at 06:27
  • If you provide a sample code of object initialization and call i would be able to help you out, you are either trying to set a property before the object is initialized or you may have encapsulated it ... there could also be other reasons that's why i'm asking for sample code – Vladimir Drenovski May 30 '16 at 06:29
  • Thanks For your information this is the code where the error occurs @WildWidow – Tareq Arar May 30 '16 at 06:42
  • Maybe this can help ... the error occurs in the classRules part @VladimirDrenovski – Tareq Arar May 30 '16 at 06:44
  • $.validator doesnt exist as the error clearly states. You must have called the code before the plugin is loaded. If it is not a plugin then u must inititalize it . `$.validator = {}` – Saneesh B May 30 '16 at 06:59
  • Thank you @SaneeshB – Tareq Arar May 30 '16 at 08:02

1 Answers1

0

Your Code tries to access an non existing JQuery namespace. You are either missing some sort of JQuery plugin, or you need to create on your self. If you would like to create the validator namespace you can use such sample code as described here

(function ($) {
    // do not overwrite the namespace, if it already exists
    $.validator= $.validator|| {};
    $.validator.classRules = function () { return {};}
    $.validator.attributeRules = function () { return {};}
})($);
Community
  • 1
  • 1