• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Need usage help for getDocumentById

 
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have the foll code


I am able to change the text Yes to No using document.getDocumentById('TR1).children(1).innerText = 'No'

Now I want to disable/enable the checkbox in a similar fashion. Any help in this regard is appreciated.
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this

 
Raghav Sam
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Niki Nono:
try this



Thanks, but I want to access the checkbox using the children property or assume there is no id for the checkbox
 
Raghav Sam
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any tutorials on getElementById?
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doing so isn't the best of ideas. By writing your code that way you couple your script to the structure of the document. If the document structure changes, your script breaks. Assigning unique ids to the elements make your script structure-independent.

That said, sometimes you just gotta do it by inspection. Your best bet is to get a good HTML DOM reference so you can see what each element exports as properties that you can use to inspect the structure and find the element(s) that you want.
 
Niki Nono
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how about this

 
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic