Links Won't Open in a Multiple Tab Environment

Discussion in 'jQuery' started by bertamus11, Jul 29, 2013.

  1. #1
    Code for multiple tabs on my page (displaying these tabs and content dynamically):
    
    jQuery('.tab-block li a').click(function() {
    var theitem = jQuery(this);
    theitem.parent().parent().find("li").removeClass("active");
    theitem.parent().addClass("active");
    theitem.parent().parent().parent().parent().find(".tab-content > ul > li").removeClass("active");
    theitem.parent().parent().parent().parent().find(".tab-content > ul > li").eq(theitem.parent().index()).addClass("active");
    return false;
    });
    
    Code (markup):
    Code in my HTML to display tabs:
    <div class="tab-block">
    <div class="tabs">
        <ul>
    <li class="active"><a href="#">TAB 1</a></li>
    <li><a href="#">TAB 2</a></li>
    </ul>
    <div class="clear-float"></div>
    </div>
    <div class="tab-content">
    <ul>
    <li class="active">
    <p><h3><a href="http://www.google.com/" rel="nofollow" target="_blank">Goole.com</a></h3></a>
    <p>Content</p>
    </li>
    <li>
    <p><h3><a href="http://www.google.com/" rel="nofollow" target="_blank">Goole.com</a></h3></a>
    <p>Content</p>
    </li>
    </ul>
    </div>
    </div>
    HTML:
    Now all tabs work great but no links will open (the H3 link within the tabs themselves). Any ideas what I'm doing wrong?
    Thank you.
     
    bertamus11, Jul 29, 2013 IP
  2. bertamus11

    bertamus11 Well-Known Member

    Messages:
    791
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    130
    #2
    Never mind. I figured it out.
    Change this line:
    jQuery('.tab-block li a').click(function() {
    Code (markup):
    to this:
    jQuery('.tabs li a').click(function() {
    Code (markup):
     
    bertamus11, Jul 30, 2013 IP