• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

trying to change value in a text field when a checkbox is ticked - trouble id'ing text field(SOLVED)

 
Village Idiot
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the DOM tree that must be navigated in order to access the text field I need to assign a new value to:




In my javascript function I have been trying things like



etc, but I just don't know the correct way to do that. Do I need to include every div id that is on the way to the field? Does the position of my javascript have any bearing on this?
BTW, I know my script is firing when I want it to, because I have an alert pop up when it gets fired, but the text field I want to assign a value to is not changing, so I am sure it is just a problem with how I identify that text field.

Thanks - Matt K
 
Marshal
Posts: 67496
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Give the element an id and use document.getElementById()
 
Matt Kohanek
Village Idiot
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear, but I was just about to post the solution I came across. I just passed the form (ship) to the javascript function, and then used

Seems to work fine that way.

Thanks though, there is still more to do and if my solution proves problematic I will try out your suggestion
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic