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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:31:59+00:00 2026-06-01T00:31:59+00:00

I am using jquery to create two sets of tabs on a page. The

  • 0

I am using jquery to create two sets of tabs on a page. The tabs display images when clicked. The first set of tabs renders fine but the second set of tabs does not render. Here is the html:

<div id="ecimgtabs">
<ul>
<li id="first"><a href="#ltec1">IMAGEI</a></li>
<li id="second"><a href="#ltec2">IMAGEII</a></li>   
</ul>
<div id="ltec1">
<img src="path"></img>
</div>
<div id="ltec2">
<img src="path"></img>
</div>
</div>


<div id="ecimgtabs">
<ul>
<li id="first"><a href="#stec1">IMAGEI </a></li>
<li id="second"><a href="#stec2">IMAGEII </a></li>  
</ul>
<div id="stec1">
<img src="path"></img>
</div>
<div id="stec2">
<img src="path"></img>
</div>
</div>

Here’s the jquery script:

$(document).ready(function(){
var tabdiv = $('#ecimgtabs div');
$('#ecimgtabs div').hide();
$('#ecimgtabs div:first').show();
$('#ecimgtabs ul li:first').addClass('selected');

$('#ecimgtabs ul li a').click(function(){
$('#ecimgtabs ul li').removeClass('selected');
$(this).parent().addClass('selected');
var currentTab = $(this).attr('href');
$('#ecimgtabs div').hide();
$(currentTab).show();
return false;
});
});
  • 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-01T00:32:01+00:00Added an answer on June 1, 2026 at 12:32 am

    Ok, I was able to figure this out. I changed the div IDs to be separate. So the 1st div changed to lecimgtabs and the next one secimgtabs. I am sure you could do it with identical IDs but this worked for me.Here’s the updated code:

    jQuery(document).ready(function()
    {
    jQuery('.lecimgtabs div:odd').hide();
    jQuery('.secimgtabs div:odd').hide();
    jQuery('.lecimgtabs ul li:even').addClass('selected');
    jQuery('.secimgtabs ul li:even').addClass('selected');
    
    jQuery('.lecimgtabs ul li a').click(function(){
    jQuery('.lecimgtabs ul li').removeClass('selected');
    jQuery(this).parent().addClass('selected');
    var currentTab = jQuery(this).attr('href');
     if(currentTab=='#ltec2')
     {
        jQuery('.lecimgtabs div#ltec1').hide();
     }
     else
     {
        jQuery('.lecimgtabs div#ltec2').hide();
     }
    
    jQuery(currentTab).show();
    return false;
    });
    
    
    jQuery('.secimgtabs ul li a').click(function(){
    jQuery('.secimgtabs ul li').removeClass('selected');
    jQuery(this).parent().addClass('selected');
    var currentTab = jQuery(this).attr('href');
     if(currentTab=='#stec2')
     {
        jQuery('.secimgtabs div#stec1').hide();
     }
     else
     {
        jQuery('.secimgtabs div#stec2').hide();
     }
    
    jQuery(currentTab).show();
    return false;
    });
    });  
    

    @kyle there was no issue with the css.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple page with two lists. Using jQuery I have set the
I'm using jQuery Cycle to create several slideshows on the same page. Some of
I am using js/jquery to create draggable graph. Graph has two draggable elements that
I am using jQuery to create a set of combo buttons in my Chrome
I am using jquery to create tabs on my GUI. My question is, I
I'm trying to create a mobile version of my views using jQuery Mobile, but
I want to create two vertical divs using HTML5, CSS3 and JQuery. One Div
I am using jquery to create a custom dropdown with the code below. I
I'm using jQuery UI to create a button to a given html element. I'm
I'm using jQuery UI to create 6 sliders with the same options (survey). I

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.