【发布时间】:2016-02-02 14:07:27
【问题描述】:
我正在使用 twitter 引导向导创建一个具有四个选项卡的向导。 我需要在单击下一个按钮时关联一个操作,例如在第一个选项卡中,我有一个用户选择一行的表,因此我禁用了下一个按钮并在选择一行时启用。问题在于下一个选项卡,因为下一个按钮的 id 对于所有选项卡都是相同的,因此我无法为每个选项卡关联不同的操作。你能给我一个解决方案吗? 谢谢,这是我的 javascript 代码:
$(document).ready(function() {
$('#acquisitionWizard').bootstrapWizard({onTabShow: function(tab, navigation, index) {
// Dynamically change percentage completion on progress bar
var tabCount = navigation.find('li').length;
var current = index+1;
var percentDone = (current/tabCount) * 100;
$('#acquisitionWizard').find('#progressBar').css({width:percentDone+'%'});
// Optional: Show Done button when on last tab;
// It is invisible by default.
$('#acquisitionWizard').find('.last').toggle(current >= tabCount);
// Optional: Hide Next button if on last tab;
// otherwise it shows but is disabled
$('#acquisitionWizard').find('.next').toggle(current < tabCount);
$("#next").addClass("disabled");
}});
$(function() {
$("#next").click(
function() {
...
【问题讨论】:
标签: javascript jquery html twitter-bootstrap button