Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
33
rated 0 times [  40] [ 7]  / answers: 1 / hits: 20617  / 11 Years ago, tue, december 24, 2013, 12:00:00

Why do I get the following error when doing the following inside the jQuery validation plugin by bassistance? IMO this should have worked, but I get this:




SyntaxError: missing : after property id




var type = $(this).type; //This is a hidden field in the form 


$(#myForm).validate({

var type = $(this).type;
rules: {
name: {
required: true,
minlength: 3,
maxlength: 51
},
},

More From » jquery

 Answers
54

It's because the validate method accepts object, yet you did not pass an object, try



$(#myForm).validate({

type : $(this).type,
rules: {
name: {
required: true,
minlength: 3,
maxlength: 51
},

[#73567] Sunday, December 22, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hadens

Total Points: 142
Total Questions: 98
Total Answers: 100

Location: Kenya
Member since Mon, Jun 14, 2021
3 Years ago
;