View Full Version : jQuery IP Validator

Feb 16th, 2009, 11:41 AM

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
Feb 16th, 2009, 11:55 AM
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

Feb 16th, 2009, 01:54 PM
That does not validate

It says invalid IP

Philip M
Feb 16th, 2009, 04:32 PM
That does not validate
It says invalid IP

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

Feb 16th, 2009, 04:34 PM
Oh Yes you are right. I was missing something....

Thanx so much for your kind help :)