+ Start a Discussion
Abhishek_NewAbhishek_New 

How to traverse through ids in javascript?

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 ?

Andres AndradeAndres Andrade

You can use jQuery :   jQuery("input[id$='COMPONENTID']");

or you can create an input:  <input type="hidden" id="myComponentId" value="{!$Component.COMPONENTID}" /> and use JS to get the id:  document.getElementById(document.getElementById("myComponentId").value).value


Hope this helps!

Hengky IlawanHengky Ilawan

Hi,

 

There is an example just like what you need in the documentation:

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global.htm

 

Regards,

Hengky