Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    892
    Thanks
    301
    Thanked 2 Times in 2 Posts

    Question jQuery IP Validator

    Hi

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

    http://digitalbush.com/projects/mask...-plugin/#usage

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

    Thanx in advance

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,733
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    I don't see why not (but you could try it out!).

    Or use this:-


    Code:
    <script type = "text/javascript">
    var ip = "129.31.1.10";
    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);
    </script>

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

  • #3
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    892
    Thanks
    301
    Thanked 2 Times in 2 Posts
    That does not validate 192.168.0.1

    It says invalid IP

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,733
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    Quote Originally Posted by cancer10 View Post
    That does not validate 192.168.0.1
    It says invalid IP
    Well, it returns true (= valid) for me.

  • #5
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    892
    Thanks
    301
    Thanked 2 Times in 2 Posts
    Oh Yes you are right. I was missing something....

    Thanx so much for your kind help


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •