View Full Version : jQuery IP Validator

02-16-2009, 12:41 PM

I was wondering if its possible to check an IP address format with this jQuery plugin?


If yes, how? If not, is there any other jQuery Plugin for it?

Thanx in advance

Philip M
02-16-2009, 12:55 PM
I don't see why not (but you could try it out!).

Or use this:-

<script type = "text/javascript">
var ip = "";
var valid = true;
var ipsub = new Array();
ipsub = ip.split(".");
for (var i = 0; i <ipsub.length; i++) {
var sub = parseInt(ipsub[i]);
if ((isNaN(sub)) || (sub <0) || (sub >255)) {
valid = false;

alert (valid);

"Very unusually it has turned noon here in Newcastle." - Football Commenator

02-16-2009, 02:54 PM
That does not validate

It says invalid IP

Philip M
02-16-2009, 05:32 PM
That does not validate
It says invalid IP

Well, it returns true (= valid) for me.

02-16-2009, 05:34 PM
Oh Yes you are right. I was missing something....

Thanx so much for your kind help :)