2016-12-17 126 views
0

我想在jQuery步驟中灰顯完成按鈕(如下圖中的Previous按鈕,用於嚮導中的步驟1和步驟2。步驟將使Finish按鈕。jquery更改一個基於id的元素到不同的類

enter image description here

我認爲最好的辦法是設置

enableFinishButton: true 

所以它的操作是有效。

我考察了鍍鉻編輯灰色的「上一個」按鈕,然後我看到了這一點:

enter image description here

在我看來,我想要的ID =「finish_button」出現在

<li class = "disabled" aria-disabled="true"> 

與步驟1中的上一個按鈕,以及在步驟2中保持在那裏,然後移動到

<li class = "aria-hidden ="false"" aria-disabled="false"> 

在步驟3它也將是很好的移動下一步按鈕到

<li class = "disabled" aria-disabled="true"> 

在第三步也是最後一步。

我不知道如何根據用戶點擊在這些不同的類的id之間移動元素。

感謝任何人都可以提供的幫助。

湯姆

+0

真的不清楚爲了使'finish'按鈕變成灰色,應該點擊哪個按鈕。 – Dekel

回答

0

我有什麼,我想你一些例子正在尋找:

// move an element to another element 

$("#finish_button").appendTo("li.disabled"); 

// or leave element where it is and change attributes and classes 

$("li[aria-hidden='false']").attr("aria-disabled","true"); 
$("li[aria-hidden='false']").addClass("disabled"); 

// set up onclick events for the buttons to make these types of changes 

$("#next_button").click(function() { 
    // code to run when next is clicked 
    // like enable finish button, disable next button. 
    $("li.disabled").removeClass("disabled"); 
}); 

這些可能不是你需要使用準確的選擇,取決於是否有可能是其他利具有相似屬性的頁面上的元素。

只要click函數不返回false或在click事件上運行preventDefault(),onclick和href就可以一起工作。

我希望它有幫助。

相關問題