jquery validator url

Solutions on MaxInterview for jquery validator url by the best coders in the world

showing results for - "jquery validator url"
Hannah
11 Jun 2020
1        $.validator.addMethod("UrlVal", function (value, element) {
2
3            var Inicio_URL = ['http://www', 'https://www', 'www', 'ftp://www'];
4            var Fim_URL = ['com', 'net', 'org', 'pt', 'eu','co'];
5
6            var Url_Inserido = value.toLowerCase().split(".");
7
8            if (Inicio_URL.includes(Url_Inserido[0])) {
9
10                if (Fim_URL.includes(Url_Inserido[(Url_Inserido.length - 1)])) {
11                    return true;
12                } else
13                    return false;
14
15            } else
16                return false;
17
18        
19        })
20
Hal
04 May 2016
1 var myURL;
2         function validURL(myURL) {
3            var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
4            '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|'+ // domain name
5            '((\\d{1,3}\\.){3}\\d{1,3}))'+ // ip (v4) address
6            '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ //port
7            '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
8            '(\\#[-a-z\\d_]*)?$','i');
9            return pattern.test(myURL);
10         }
11         document.write(validURL("http://qries.com"));