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 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Auckland, New Zealand
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    function to detect numbers in form field

    Hi codingforum

    I'm working on developing a form where I want to make sure the Street Address field has got a number in the first part of the field.

    Can anyone help with this, please?

    bye
    Allyson

  • #2
    New Coder
    Join Date
    Jun 2002
    Location
    Spain
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this, I suposse it will work:

    function detect (text)
    {
    var firstNumber=text.substr(0,1);
    if (parseInt(firstNumber)+""!=firstNumber)
    alert ('Needs to begin with a number');
    }

  • #3
    Regular Coder
    Join Date
    May 2002
    Location
    Helsinki, Finland
    Posts
    231
    Thanks
    0
    Thanked 1 Time in 1 Post
    Zvona
    First Aid for
    Web Design


  •  

    Posting Permissions

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