ラジオボタンに基づいたjQueryボタンセットを使用してウェブサイトにエディタ機能を構築しています。エディタにアイテムをロードすると、選択したラジオボタンを設定する必要があります。そして、オプションを変更してデータベースに保存します。アイテムが閉じると、ボタンセットをデフォルトにリセットします。jQueryボタンセットのラジオをプログラムで選択すると分解されます
問題は、ボタンセットを設定すると、最初に各アイテムを選択したときに機能し、その後、すべてが一緒に動作しなくなります。問題の
デモ:http://jsfiddle.net/kallsbo/vSmjb/
HTML:
<div id="dumpSec">
<input type="radio" name="security" id="r_public" value="public" class="rSec">
<label for="r_public"><i class="icon-globe"></i> Public</label>
<input type="radio" name="security" id="r_private" value="private" class="rSec">
<label for="r_private"><i class="icon-lock"></i> Private</label>
<input type="radio" name="security" id="r_link" value="link" class="rSec">
<label for="r_link"><i class="icon-link"></i> Anyone with the link</label>
</div>
<div>
If you use the buttons below you can programmatically select each of the radios in the buttonset once before it all breaks down...
</div>
<div>
<button id="nbr1">Select Private</button><br/>
<button id="nbr2">Select Link</button><br/>
<button id="nbr3">Select Public</button><br/>
</div>
JavaScriptを:私はそれぞれのラベルのクリック機能をトリガしようとしているようなものの数を試してみました
// Basic function
$("#dumpSec").buttonset();
$("#r_public").attr("checked", true);
$("#dumpSec").buttonset('refresh');
// Put in functions on the demo buttons
$("#nbr1")
.button()
.click(function(event) {
$("#r_private").attr("checked", true);
$("#dumpSec").buttonset('refresh');
});
$("#nbr2")
.button()
.click(function(event) {
$("#r_link").attr("checked", true);
$("#dumpSec").buttonset('refresh');
});
$("#nbr3")
.button()
.click(function(event) {
$("#r_public").attr("checked", true);
$("#dumpSec").buttonset('refresh');
});
ラジオボタンなどがありますが、動作するものは何も見つかりません。すべての入力をいただければ幸いです!
解決方法とドキュメントへのリンクがありがとうございます。 –