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 7183065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:54:14+00:00 2026-05-28T17:54:14+00:00

I created a re-usable plugin for a system I’m building. All seems to work

  • 0

I created a re-usable plugin for a system I’m building. All seems to work fine as long as I only have 1 element on the page. If I have 2, the links and panels hide for both on a single click. How do I scope the plugin to work independently on each?

Thanks in advance.

The plugin is for tab creation and goes like this:

  (function($){

      $.fn.wbTabs = function() {

          return this.each(function(){

              // caching selectors
              $this = $(this);
              $tabLinks = $this.find('.tabs li a');
              $firstTab = $this.find('.tabs li:first a');
              $panels = $this.find('.panel');            

              // function on tab click
              $tabLinks.click(function() {
                  $panels.hide();
                  $tabLinks.removeClass('active');
                  $(this).addClass('active').blur();
                  var panel = $(this).attr('href');
                  $(panel).show();

                  // prevent link from clicking
                  return false;
              });

              // make first tab active
              $firstTab.click();           
          });
      };
  })(jQuery);

Then I call the plugin with this:

 $('.wb-tabs-container').wbTabs();
  • 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-05-28T17:54:15+00:00Added an answer on May 28, 2026 at 5:54 pm

    Declare your variables, var, inside your plugin and you’ll be good. You’re setting global vars which ends up breaking your plugin (and will fail in some browsers anyway). fiddle: http://jsfiddle.net/brentmn/uJbxz/3/

            var $this = $(this);
            var $tabLinks = $this.find('.tabs li a');
            var $firstTab = $this.find('.tabs li:first a');
            var $panels = $this.find('.panel');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a plugin registered for when an account is created or updated, this
I have created a VSTO plugin with my own RTD implementation that I am
I have tied this jQuery Bar Graph plugin with a function that I created.
I've created a couple of little few page long websites for one time projects
I have created a google-app-engine java project in Eclipse using Google's Eclipse plugin. My
I have ran into an interesting issue while trying to create a more usable
I have created a divider in JSplitPane . I am unable to set the
I created a Console application which searches for plugins ending with PlugIn.dll. It loads
I currently have created a pagination JavaScript class that will automatically paginate comments when
My over all goal is to upload a very simple ASP.NET web site created

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.