如何根据jquery中的选定选项卡交换选项卡名称

时间:2013-09-10 03:24:59

标签: javascript jquery html css tabs

这是我的小提琴 http://jsfiddle.net/LTpL6/

 Code:
    <ul class="tabs_down_link">
        <li ><a style="   padding: 7px 14px;font-size: 16px; color: #000; border-  bottom:1px solid #FFFFFF;"  href="#view_down7">Subject Area-Based Citations</a></li>
                                                                <li ><a    href="#view_down8">Sub-Area Based Citations</a></li>
          </ul>

 <div class="tabcontents_down_link">
  <div id="view_down7" style="line-height:180%; font-size: 14px;font-weight: bold;  color: #808080; ">
                                                                    <input   type="checkbox" />&nbsp;(SciCI)<br/>
                                                                    <input   type="checkbox" />&nbsp;(SS&HCI)<br/>
                                                                    <input  type="checkbox" />&nbsp; (M&HSCI) <br/>
                                                                    <input  type="checkbox" />&nbsp;(LSciCI)<br/>

</div>

  <div id="view_down8" style="font-weight: bold;line-height:180%; font-size: 14px; color: #808080;">
                                                                    <input    type="checkbox" />&nbsp;History Citation Index<br/>
                                                                    <input  type="checkbox"/>&nbsp;Religion Citation Index<br/>
                                                                    <input   type="checkbox" />&nbsp;Biotechnology Citation Index<br/>
                                                                    <input  type="checkbox" />&nbsp;Food Science Citation Index<br/>
                                                                    <input  type="checkbox" />&nbsp;Chemistry Citation Index<br/>
                                                                    <input  type="checkbox" />&nbsp;Mathematics Citation Index<br/>
                                                                    <input  type="checkbox" />&nbsp;Neuroscience Citation Index<br/>
                                                                    <input   type="submit" class="search-butt" style="margin-left: 727px; float: left;"  name="submit_docu" value="Search" /><br/>
                                                                </div>
                                                            </div>

   Jquery
   $(document).ready(function () {
   $('div[id^=view_down]').hide();
   $('#view_down7').show();
   $('.tabs_down_link a').click(function () {
   var tab_id = $(this).attr('href');
   var now = $(this).attr('.tabs_down_link a');
   $('div[id^=view_down]').hide();
   $(tab_id).show(); 
   });
  });

这里一切正常。

现在有两个标签 1.主题区域引文 2.基于区域的引用

有一个公共div,用户点击任何特定选项卡上的内容将显示在该公共div中,现在它正确显示,但我需要根据单击的选项卡更改选项卡名称。

所以现在默认为“基于主题区域的引文”选项卡,因此当用户尝试单击“基于子区域的引文”时,选项卡名称“基于子区域的引文”&#39;应自动进入第一个默认选项卡。

如何做到这一点请帮助。

1 个答案:

答案 0 :(得分:0)

您可以使用此

交换位置
$(this).before($('div[id^=view_down]'));
相关问题