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
    Regular Coder
    Join Date
    Jun 2002
    Location
    Stillwater Ok
    Posts
    226
    Thanks
    0
    Thanked 0 Times in 0 Posts

    script reads input value one step back

    http://www.eskimo151.com/test.asp

    I would like to know exactly what the length of an input is after someone updates the control. Not after the focus has moved on, but while the element has focus. The method I'm using now seems to fire before the control is actually updated, thus the value.length seems to be behind a step.

    At first I just thought I must be using the wrong event, that onchange or onkeyup must be what I was looking for. After some trial and many many errors, I have decided that the events are not my problem, but my perception.

    I'm in need a fresh pair of eyes.

    [EDIT]
    It just occurred to me, but this may not be the correct place to post this..

    Should it be moved to the javascript forum?
    Last edited by Eskimo; 02-18-2005 at 09:33 PM.
    "Never offend people with style when you can offend them with substance."
    --Sam Brown

  • #2
    New Coder
    Join Date
    Mar 2004
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Change your event handler to onkeyup.

    if(formInputs[i].id=="myId") formInputs[i].onkeyup = function(){myFunction(this)};

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Stillwater Ok
    Posts
    226
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I feel like a tard... I swore I tried that.

    Thank you very much for pointing out my oversight. It works just fine now.
    "Never offend people with style when you can offend them with substance."
    --Sam Brown


  •  

    Posting Permissions

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