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

131
Views
Find which tab is active

Can anyone help me to identify which tab is active from below code below is my click function

$('.list-group-item').on('click', function (e) {
  var previous = $(this).closest(".list-group").children(".active");
  alert($(this).closest(".list-group").children(".active"));
  previous.removeClass('active'); // previous list-item
  $(e.target).addClass('active'); // activated list-item
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container">
    <div class="col-md-4">
        <ul class="list-group help-group">
            <div class="faq-list list-group nav nav-tabs">
                <a href="#tab1" class="list-group-item active" role="tab" data-toggle="tab"> General Help (Power
                Apps/Automate)</a>
                <a href="#tab2" class="list-group-item" role="tab" data-toggle="tab"><i class="mdi mdi-account"></i>
                Landscape Report</a>
                <a href="#tab3" class="list-group-item" role="tab" data-toggle="tab"><i class="mdi mdi-account-settings"></i>
                Mobile</a>
                <a href="#tab4" class="list-group-item" role="tab" data-toggle="tab"><i class="mdi mdi-star"></i>
                Maintainability</a>
                <a href="#tab5" class="list-group-item" role="tab" data-toggle="tab"><i class="mdi mdi-cart"></i> Errors</a>
            </div>
        </ul>
    </div>
</div>

when i tried putting alert

alert($(this).closest(".list-group").children(".active"));

it show me

object object

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

0

You can retrieve the attributes of the active element:

alert($(this).attr('href'));
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!