I'm currently trying hard to get my jQuery to work in IE7, when I Lint the following:
$(".regflow").validate({
errorLabelContainer: $("#error-message"),
rules: {
txtTextOnly: {required: true,textOnly: true},
txtNumbersOnly: {required: true,numbersOnly: true},
txtPhoneOnly: {required: true,phoneOnly: true},
txtAreaCodeOnly: {required: true,numbersOnly: true},
txtSimCodeOnly: {required: true,simCodeOnly: true},
txtCprOnly1: {required: true,numbersOnly: true},
txtCprOnly2: {required: true,cprOnly1: true},
txtMailOnly: {required: true,mailOnly: true}
},
messages: {
txtTextOnly: {required: "Dette felt skal udfyldes"},
txtNumbersOnly: {required: "Dette felt skal udfyldes"},
txtPhoneOnly: {required: "Dette felt skal udfyldes"},
txtAreaCodeOnly: {required: "Dette felt skal udfyldes"},
txtSimCodeOnly: {required: "Dette felt skal udfyldes"},
txtCprOnly1: {required: "Dette felt skal udfyldes"},
txtCprOnly2: {required: "Dette felt skal udfyldes"},
txtMailOnly: {required: "Dette felt skal udfyldes"}
},
});
... I get this error from Lint: "warning: trailing comma is not legal in ECMA-262 object initializers"
Does anyone know what this means, and how do I fix it?
Remove the trailing comma - the comma at the end of the following part:
messages: {
txtTextOnly: {required: "Dette felt skal udfyldes"},
txtNumbersOnly: {required: "Dette felt skal udfyldes"},
txtPhoneOnly: {required: "Dette felt skal udfyldes"},
txtAreaCodeOnly: {required: "Dette felt skal udfyldes"},
txtSimCodeOnly: {required: "Dette felt skal udfyldes"},
txtCprOnly1: {required: "Dette felt skal udfyldes"},
txtCprOnly2: {required: "Dette felt skal udfyldes"},
txtMailOnly: {required: "Dette felt skal udfyldes"}
},
While creating an object {}
or an array []
, you separate individual elements with a comma. But here there is an additional comma after the last item like [a, b, c,]
- that is not allowed as per ECMA-262.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With