Is there a good IP Mask plugin for JQuery? I\'ve tried Masked Input Plugin but it doesn\'t IP Addresses with less than 12 digits. Then I\'ve tried meioMask and this doesn\'t wor
i found this and you don´t need to install plugins
function fnValidateIPAddress(ipaddr) {
//Remember, this function will validate only Class C IP.
//change to other IP Classes as you need
ipaddr = ipaddr.replace( /\s/g, "") //remove spaces for checking
var re = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; //regex. check for digits and in
//all 4 quadrants of the IP
if (re.test(ipaddr)) {
//split into units with dots "."
var parts = ipaddr.split(".");
//if the first unit/quadrant of the IP is zero
if (parseInt(parseFloat(parts[0])) == 0) {
return false;
}
//if the fourth unit/quadrant of the IP is zero
if (parseInt(parseFloat(parts[3])) == 0) {
return false;
}
//if any part is greater than 255
for (var i=0; i 255){
return false;
}
}
return true;
} else {
return false;
}
}