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

148
Views
Bootstrap Collapsible w/ion-icons that change on click

I'm using bootstraps collapsible containers on a website to display some info, I am also using ion-icons to have a + & - to indicate when the container is open or closed, for some reason I am struggling to target the icons to be able to change them, I've tried this thus far.

html

<div class="accordion-item">
                <div class="accordion-header w-100" id="headingOne">
                    <a class="collapsed w-100 d-flex justify-content-between align-items-center" id="toggle" data-bs-toggle="collapse" data-bs-target="#collapse-One" aria-expanded="true" aria-controls="collapse-One">
                        Title <ion-icon itemid="iconChange" name="add"></ion-icon>
                    </a>
                </div>
                <div id="collapse-One" class="accordion-collapse collapse" aria-labelledby="headingOne" data-bs-parent="#accordionProductInfo">
                    <div class="accordion-body">
                        Info
                    </div>
                </div>
            </div>

js

var myCollapsible = document.getElementById('#toggle')
        myCollapsible.addEventListener('show.bs.collapse', function () {
            var icon = $("#iconChange");

            icon.attr('name', 'remove-outline');
            console.log(icon[0]);
        });

I know this is only to change it one way so far but I cant even get a message out of the console log.

about 4 years ago · Juan Pablo Isaza
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!