現在、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の初心者です。