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

227
Views
Insert data after event.target (Owl Carousel)

I am following this codepen here to insert the current and total number of slides on an Owl carousel. Trouble is it targets a div with ID #counter. So if there are multiple carousels on the same page then the value is always overwritten for both and not the current slider.

I dont seem to be able to manipulate the contents of event.target as it appears to be read only.

I have found if I change this line:

$('#counter').html("item "+item+" of "+items)

To this then it works. But the new value is always appended and I don't seem to be able to replace it.

$(event.target).append(item+" - "+items);
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Try this way: First of all you can not set more then ONE tag with the same ID at the html page. It wrong way of codding totaly. So set the div with class:

<div class="counter"></div>

In the js function change you string from:

$('#counter').html("item "+item+" of "+items)

To:

$(event.target).next('.counter').html("item "+item+" of "+items)

And you get:

enter image description here

about 4 years ago · Santiago Gelvez 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!