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

93
Views
How to target classes with dynamically added classname in jQuery

I'm trying to use one piece of code to expand different content when different sections are clicked on. The way I'm trying to achieve this is by giving these tags a class name like class="counter_1", class= "conter_2"...and naming the subsequent content with numbers corresponding to the span class names. I've so far been able to name my span tags with jQuery:

$("span").each(function(i){
var $this = $(this);
$this.addClass("title" + (i+1));

});

but I'm not quite sure where to go from here. How do I target these dynamically added classes to have them expand the content I want to show?

Sorry if this description isn't so clear, I'm very new to jQuery :(

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!