function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abhishek_NewAbhishek_New 

How to traverse through ids by document.getElementById..

I have different levels

1.Apex:page

2.form

3.pageblock

3.pageblocksection

4.inputfield

 

Every level has their ids.Now in JScript I want to traverse through ids by document.getElementById....how to traverse ?Directly using .inputfield id is not working,,,,,Suggestion please!

Nick00000Nick00000
jwhartfieldjwhartfield

I'm not entirely clear on your problem.  Are you just trying to select the specific input element and are not sure what the id is?

 

Just make sure you give the element an id - so your Visualforce code should look like <apex:inputfield id="myInputField" />.  Salesforce will give it an ID but they append an enumeration for each parent element.  So, if your page looks like this:

 

Apex:page id="page"

2.form id="form"

3.pageblock id="block"

3.pageblocksection id="section"

4.inputfield id="myInputField"

 

Your input field will be rendered with an id that looks like this: id="page:form:block:section:myInputField"

 

If you use document.getElementByID('page:form:block:section:myInputField') that should grab it.  If you aren't sure of the name, just view the page source and grab the id of the input field from there.