Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8741741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:22:13+00:00 2026-06-13T11:22:13+00:00

My question is rather simple. I am working with a CMS where editors of

  • 0

My question is rather simple.
I am working with a CMS where editors of the site can drag and drop multiple widgets on the same page.

Widgets all have the exact same html.
For example there can be a carousel, photo gallery, etc.
I have written javascript to make these widgets interactive but how do I make each widget act separately on its own.

For example, clicking on the next button on one carousel, should not scroll all the carousels in the page.

So I can’t do something like:

   function bindEvents() { 
       $('.next').on({ 
           click: function () { 
              ...
           }
        });
    }

Because all the widgets have the same html , for example:

<div class='carousel'>
    ....
    <span class='next'>Next</span>
    ....
</div>

I would really appreciate some help.
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:22:13+00:00Added an answer on June 13, 2026 at 11:22 am

    Isolating repeating elements in a page is usually fairly simple by using the widget wrapper as the context for all your code

    $('.next').on('click', function() {
        /* store the current widget element and make all searches from this point*/
        var $carousel = $(this).closest('.carousel');
        $carousel.find('.someClass').doSomething();
        $carousel.find('.anotherClass').doSomethingElse()
    });
    

    Only the elements within the same carousel as the button will be affected since they are being searched within the button’s parent carousel only

    You can expand on this by checking the additional class of widget

    <div class='carousel slideshow'>
    
    /* within above handler code */
    if( $carousel.is('.slideshow') ){
      /* run code specific to slideshow class of carousel only */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a rather simple question. Does anyone knows if i can use jparallax both
A rather simple question really. I'm working on a project where I need to
A rather simple question, but I can only find answers to more complex questions.
My question is rather simple. Let's suppose I'm executing the algorithm A star (search
my question is rather simple, if you have an pure virtual class (interface) but
I think its a rather simple question but I couldn't really find an answer
I have a rather simple question that I could normally debug myself, but I
Rather a simple question. But the implications are vast. Over the last few weeks
I'm rather new to WPF, so maybe this is a simple question. I have
I wanna make this rather simple to ask so I can hope for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.