Home » jQuery » jQuery url Validation

jQuery url Validation

When  lost focus  from the input box the script will check the URL against its Syntax

$(‘input’).keydown(function() {
        if (ischeckUrl($(this))==1){
            alert(“enter a valid url…”);   
//function to check URL
function isCheckUrl(checkurl){
    if(/^(http|https|ftp)://[a-z0-9]+([-.]{1}[a-z0-9]+)*.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?$/i.test(url)) {
      return 1;
    } else {
      return -1;

Leave a Reply


Check Also

How to Check Expired Sessions using jQuery Ajax and PHP

We can achieve using the php and ajax.The following ajax call execute in every 10 ...