I have to validate the ip address submitted from the form. I have tried the code below in jQuery, but it does not work.
var IpAddresslanText = $("#IpAddresslan").val();
if(IpAddresslanText == '') {
alert('enter IpAddresslan');
return false;
}
var ipformat = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
if(!IpAddresslanText.match(ipformat)) {
alert("You have entered an invalid IP address!");
return false;
}
Thanks in advance