Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
23
rated 0 times [  29] [ 6]  / answers: 1 / hits: 104748  / 14 Years ago, wed, february 9, 2011, 12:00:00

I am getting this error :



SyntaxError: missing ; before statement


Why would I get that from this code? How can I get around this ?



var $this = $(input);
foob_name = $this.attr('name').replace(/[(d+)]/, function($0, $1) {
return '[' + (+$1 + 1) + ']';
}));

More From » jquery

 Answers
68

Looks like you have an extra parenthesis.



The following portion is parsed as an assignment so the interpreter/compiler will look for a semi-colon or attempt to insert one if certain conditions are met.



foob_name = $this.attr('name').replace(/[(d+)]/, function($0, $1) {
return '[' + (+$1 + 1) + ']';
})

[#93828] Monday, February 7, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
janjadonb

Total Points: 4
Total Questions: 114
Total Answers: 118

Location: Mali
Member since Fri, Dec 3, 2021
3 Years ago
janjadonb questions
;