我目前居住的問題是需要將值傳遞給Jquery UI對話框,但我不知道如何。我已到處檢查文檔,但似乎沒有任何工作。這是我有什麼(都試過)如何在JQuery UI對話框中設置元素的值
實際對話:
<div id="amountDialog" title="Add to Basket">
<table style="text-align: center">
<tr>
<td colspan="2">
<p id="productAdd"></p> <!-- need to set this value -->
</td>
</tr>
<tr>
<td>
<input type="text" id="modalInputAmount" />
</td>
<td>
<p id="maxAmt">Maximum Amount: </p>
</td>
</tr>
</table>
</div>
對話框選項:
$("#amountDialog").dialog({
autoOpen: false,
width: 'auto',
modal: true,
buttons : {
"OK" : execute
},
open : function (event, ui) {
$("#productAdd").val('How many [' + item + ']\'s do you wish to add to the basket?"'); <!-- item is the global variable describing which item is added to the basket -->
}
});
開放代碼
$("#amountDialog").dialog("open");
我不會打擾粘貼在這裏執行代碼,因爲我知道這是行得通的,我可以從模式對話框中的文本框中獲取值。然而,我擔心的是,如何在模態對話框打開時設置#productAdd
段落的值?
只需要把它放在那裏,我仍然是一個JQuery的新手。
我認爲它返回了一個值。打開對話框的按鈕嵌套在table> tbody> tr> td(它是一個動態按鈕)之間。所以這(按鈕)。父母(td)。父母(tr)。第n個孩子(1)因此獲得該行中第一列的值,該按鈕在 – Eon 2013-02-10 08:14:23
中或者不是。只是看到了錯誤哈哈 – Eon 2013-02-10 08:14:43