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

354
Views
How To Get Odoo Qweb Loop Index Value in JavaScript Function

I'm trying to get the announcement index announcement[0] for each announcement in the code below but I keep getting the same index at [0] when i console.log which is 17 even if I click on a different announcement rendered from the loop. How do I capture every announcement ID [17,18,19....] separately in JavaScript?

<t t-foreach="widget.announcements" t-as="announcement">
        <div class="col-sm-12 col-lg-12 hr_announcement" style="padding:0;">
            <div class="text-color">
                <div class="">
                    <div class="media">
                        <div class="media-body">
                            <h2 id="announcementID" class="text-color display-6" style="font-size: 11px; visibility: hidden;"><t t-esc="announcement[0]"/> </h2>
                            <h2 class="text-color display-6" style="font-size: 11px;"><t t-esc="announcement[1]"/> </h2>
                            <p><a href="#" style="font-size: 15px; color: #5ebade;"><b><t t-esc="announcement[2]"/></b></a></p>
                            <h2 class="text-color display-6" style="font-size: 11px;"><b>Start Date:</b> <t t-esc="announcement[3]"/> - <b>End Date:</b> <t t-esc="announcement[4]"/></h2>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </t>

JavaScript Part:

hr_announcement: function(e) {
    let announcementID = document.getElementById('announcementID').innerHTML;
    console.log(announcementID)
    e.preventDefault();
},
about 4 years ago · Santiago Trujillo
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!