I need to add IP Validation in my project .Is there any function in jquery or in jquery mobile.So that it will validate the in put field?
Thanks
I use jQuery Validation Plugin by:
$.validator.addMethod('IP4Checker', function(value) {
var ip = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$";
return value.match(ip);
}, 'Invalid IP address');
$('#form').validate({
rules:{
ip:{
required: true,
IP4Checker: true
}
}
});
Hope helpful.
Refer to: Regular expression to match DNS hostname or IP Address?