标签: jqueryi-ui-buttonset

以编程方式在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>
Run Code Online (Sandbox Code Playgroud)

JavaScript的: …

javascript jquery jquery-ui jqueryi-ui-buttonset

9
推荐指数
1
解决办法
1万
查看次数

使用jqueryUI buttonset时,无论如何都要确定它是否已初始化?

我有jQuery代码刷新按钮集:

$("#myRadio").buttonset('refresh');
Run Code Online (Sandbox Code Playgroud)

但我找到了一个用例,它在此行之前被调用:

$("#myRadio").buttonset();
Run Code Online (Sandbox Code Playgroud)

然后爆炸,因为它没有初始化.我想看看是否有办法确定这个buttonset()初始化是否已经发生,所以我可以在调用referh之前检查:

就像是:

if($("#myRadio").buttonsetIsInitialized())
{
    $("#myRadio").buttonset('refresh');
}
Run Code Online (Sandbox Code Playgroud)

检查的正确方法是什么?

jquery jquery-ui jqueryi-ui-buttonset

6
推荐指数
1
解决办法
482
查看次数

如何禁用jQuery-UI buttonset的一个按钮?

这里的例子:

http://jsfiddle.net/UVHtu/19/

我需要填补空白:

HTML:

<div id="options">
    <input type="radio" id="op_a" name="op" value="a" />
    <label for="op_a">Option A</label>
    <input type="radio" id="op_b" name="op" value="b" />
    <label for="op_b">Option B</label>
    <input type="radio" id="op_c" name="op" value="c" />
    <label for="op_c">Option C</label>
</div>
<input type="button" id="disable_button" value="Disable Option B" />
?
Run Code Online (Sandbox Code Playgroud)

JavaScript的:

$("#options").buttonset();

$("#disable_button").click(function(){
    // What goes here to disable option B?
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-ui jquery-ui-button jqueryi-ui-buttonset

2
推荐指数
1
解决办法
2715
查看次数