Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

115
Views
how to generate different div id inside ui:repeat for javascript code

I have one ui:repeat component and inside that ui:repeat there is one div which is using in my javascript code. I have to dynamically change this div id on each ui:repeat call. how can i make it possible?

Please find the below code for your reference.

Xhtml Code

<ui:repeat var="id1" value"#{somethingbean.some"} id="repeaterId" varStatus="rowStatus" 
  rendered="somethingbean.some.someisthere">
 <fieldset class="mock">
 <legend></legend>

 <div id="idToChange">
  .....................................................
  .............................................................
 </div>

</fieldset>
</ui:repeat>

JS Code

 function loadFunction() {
     let varsome= document.getElementsById('idToChange');

     }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This should be possible accessing rowStatus.index.

<ui:repeat var="id1" value"#{somethingbean.some"} id="repeaterId" varStatus="rowStatus" 
  rendered="somethingbean.some.someisthere">
 <fieldset class="mock">
 <legend></legend>

 <div id="prefix#{rowStatus.index}">
  .....................................................
  .............................................................
 </div>

</fieldset>
</ui:repeat>

EDIT

<ui:repeat var="id1" value"#{somethingbean.some"} id="repeaterId" varStatus="rowStatus" 
  rendered="somethingbean.some.someisthere">
 <fieldset class="mock">
 <legend></legend>
 <input type="checkbox" onclick="(evt)=>handleCheckboxClicked(evt,'prefix#{rowStatus.index}')" />
 <div id="prefix#{rowStatus.index}">
  .....................................................
  .............................................................
 </div>

</fieldset>
</ui:repeat>
function handleCheckboxClicked(evt,id){
    const div = document.getElementById(id);
    
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!