Answers for "jquery validator Url"

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;

        
        })
Posted by: Guest on November-10-2020
0

jquery check valid link

var myURL;
         function validURL(myURL) {
            var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
            '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|'+ // domain name
            '((\\d{1,3}\\.){3}\\d{1,3}))'+ // ip (v4) address
            '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ //port
            '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
            '(\\#[-a-z\\d_]*)?$','i');
            return pattern.test(myURL);
         }
         document.write(validURL("http://qries.com"));
Posted by: Guest on February-17-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language