2011-02-03 59 views
0

我在这里找到了这个伟大的jqueryui buttonset脚本在stackoverflow。这是为了复选框,我需要单选按钮。与JqueryUI的单选按钮集 - 更改选择

这里:http://jsbin.com/eyonu5

基本上我希望它做的是交换基于当前选择的图标。现在它只基于点击单选按钮来交换图标。

任何帮助,非常感谢。

感谢

回答

0

这可能不是不写这个...... 最有效的方式,但它的工作原理The edit on your jsbin link


var noIcon = {primary: null, secondary: null} 
var withIcon = {primary: 'ui-icon-custom-tick', secondary: null}; 

$('input[name="mainautoresize"]:radio').change(function() { 
    if($('input:not(:has(:radio:checked))')) { 
     $('input:not(:has(:radio:checked))').button("option", "icons", noIcon).button('refresh'); 
    } 

    if($('input:radio:checked')) { 
     $(this).button("option", "icons", withIcon).button('refresh'); 
    } 
}); 

$('#mainautoresize').buttonset();​