2012-07-11 115 views
4

在我的freemarker頁面中,我創建了4個選項卡。我想要的:如果用戶在第4個標籤中,只有他才能看到提交按鈕。當他在第一,第二或第三個標籤時,他可以看到下一個和上一個按鈕。如何創建活動的下一個或上一個標籤按鈕點擊使用jQuery或JavaScript?任何一個請幫助...如何使twitter引導選項卡作爲表單嚮導?

<div class="tabbable"> 
    <ul class="nav nav-tabs"> 
     <li class="active"><a href="#declarations1" data-toggle="tab">Declarations</a></li> 
     <li><a href="#hradetails1" data-toggle="tab">HRA Details</a></li> 
     <#if IsHidePrevEmpITDeclaration?exists && IsHidePrevEmpITDeclaration != "true"> 
     <li><a href="#preEmpSalary1" data-toggle="tab">Previous Employment Salary</a></li> 
     </#if> 
     <li><a href="#otherIncome1" data-toggle="tab">Other Income</a></li> 
    </ul> 
</div> 

在此先感謝...

回答

7
<div class="tabbable columns"> 
    <ul id="myTab" class="nav nav-tabs"> 
     <li class="active"><a id="n.1" href="#declarations1" data-toggle="tab"> Declarations </a></li> 
     <li class=""><a id="n.2" href="#hradetails1" data-toggle="tab">HRA Details</a></li> 
     <li class=""> <a id="n.3" href="#preEmpSalary1" data-toggle="tab">Previous Employment Salary</a></li> 
     <li><a id="n.4" href="#otherIncome1" data-toggle="tab">Other Income</a></li> 
    </ul> 
    <div id="myTabContent" class="tab-content"> 
     <div class="tab-pane fade active in" id="declarations1"> 
      <p>The first content</p> 
      <input type="button" onclick="document.getElementById('n.2').click()" value="Next" /> 
     </div> 
     <div class="tab-pane fade" id="hradetails1"> 
      <p>The 2nd content</p> 
      <input type="button" onclick="document.getElementById('n.3').click()" value="Next" /> 
      <input type="button" onclick="document.getElementById('n.1').click()" value="Previous" /> 
     </div> 
     <div class="tab-pane fade" id="preEmpSalary1"> 
      <p>The 3rd content</p> 
      <input type="button" onclick="document.getElementById('n.4').click()" value="Next" /> 
      <input type="button" onclick="document.getElementById('n.2').click()" value="Previous" /> 
     </div> 
     <div class="tab-pane fade" id="otherIncome1"> 
      <p>The 4th content</p> 
      <input type="submit" value="submit" /> 
     </div> 
    </div> 
</div> 
+1

我建議使用''而不是'

+0

@HomunculusReticulli遲到但已完成! :) – osyan 2014-01-12 22:47:37

6

這Twitter的引導插件構建了一個嚮導進行格式化tabbable結構。它允許使用按鈕構建嚮導功能,以執行不同的嚮導步驟,並且使用事件可以單獨掛鉤到每個步驟。檢查出Github

+1

鏈接與否,這是最好的答案。 – Justin 2012-12-04 01:30:22

+0

由於您是此代碼和存儲庫的所有者,因此您不妨提升自己。 – 2015-01-30 06:51:32

相關問題