jquery validation cdn code example
Example 1: jquery validator Url
$.validator.addMethod("UrlVal", function (value, element) {
var Inicio_URL = ['http://www', 'https://www', 'www', 'ftp://www'];
var Fim_URL = ['com', 'net', 'org', 'pt', 'eu','co'];
var Url_Inserido = value.toLowerCase().split(".");
if (Inicio_URL.includes(Url_Inserido[0])) {
if (Fim_URL.includes(Url_Inserido[(Url_Inserido.length - 1)])) {
return true;
} else
return false;
} else
return false;
})
Example 2: jquery form validation
function submitFunction(event){
event.preventDefault();
}
$("#form_id").submit(submitFunction);
Example 3: jquery validate
$("#myform").validate({
debug: true
});