jquery validator driving license
snippet in javascript

jquery validator driving license

user9804

        $.validator.addMethod("Drive_License", function (value, element) {

            var Tipos_Licenca = ['A', 'A1', 'A2', 'AM', 'B', 'B1', 'BE','C','C1','C1E','D','D1','D1E','DE'];
            var i = 0;

            var Licencas_Inseridas = value.toUpperCase().split(",");

            while (i < Licencas_Inseridas.length) {
                if (!Tipos_Licenca.includes(Licencas_Inseridas[i])) {
                    return false;
                }
                i++;
            }

            return true;
        })