facebook

how to loop thru textFields with a for loop: CLOSED

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #348495 Reply

    DaveClark
    Participant

    I am doing some calculations and I want to display the results to some textFields. I have them named textField0 thru textField19.

    I am trying this:

    for(n=1; n<shox_stroke; n++)
    {
    document.getElementById(‘m1-air_spring-textField[n]’).value = n +” = ” + wheel_rate.toFixed(0);
    }

    it does not seem to follow the n variable.

    how do I put the n variable to the textField name to loop to each textField ?

    Thanks for any help

    #348504 Reply

    Code_A
    Member

    Try changing textField[n] to ‘…textField’ + n + ‘).value… The textFields are not an array so the []’s won’t work in this case.

    #348508 Reply

    DaveClark
    Participant

    Thanks for the help. I messed with it and got it working

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: how to loop thru textFields with a for loop: CLOSED

You must be logged in to post in the forum log in