performance - How define jQuery validate setDefaults -


i have problem code. use jquery validate validate form. question how run setdefaults method? because when looking @ in debugger, error this: typeerror: jquery.validator undefined

jquery.validator.setdefaults({             success : "valid"         });         $("#myform").validate({             rules : {                 "file1" : {                     required : true,                     extension : "slx|mdl",                     accept : false                 },                 "file2" : {                     extension : "m",                     accept : false                 },                 "file3" : {                     extension : "xlsx|xls",                     accept : false                 },                 "file4" : {                     extension : "pdf",                     accept : false                 }               }         }); 

setdefaults need variable must used validate in case validator

just assign validator var validate method

var validator = $("#myform").validate({     rules : {         "file1" : {             required : true,             extension : "slx|mdl",             accept : false         },         "file2" : {             extension : "m",             accept : false         },         "file3" : {             extension : "xlsx|xls",             accept : false         },         "file4" : {             extension : "pdf",             accept : false         }       } }); 

should work fine


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -