I'm trying to make data attributes based validation.
However, when I'm adding my numeric
method, it's not working.
$.validator.addMethod('[data-v-numeric="numeric"]', function(value, element) {
console.log(1);
return !isNaN(parseInt(value));
}, objLanguage['validation_numeric']);
What I found in the documentation: "name Type: String The name of the method used to identify it and referencing it; this must be a valid JavaScript identifier"
So I have 2 elements $('[data-v-numeric="numeric"]')
and how I thought [data-v-numeric="numeric"]
is valid JavaScript selector. But somehow It's not working. Where I made an error then?