每次用户访问选项卡菜单时,都会尝试刷新单选按钮的列表。第一次访问样式是可以的,但它们表现得像复选框,并且当其他单选按钮被点击时不能被取消选中。单选按钮不会动态应用样式
我试图把refresh();
方法,但它仍然无法正常工作。
你可以看到JSFIDDLE
任何建议的演示?谢谢。
$('.export_tab').click(function(){
$("#radios_wrapper").children().remove(); //Remove all previous radio buttons
for(var i in localStorage) //Looping through the localStorage
{
dataIndex = JSON.parse(localStorage[i]).index;
dataName = JSON.parse(localStorage[i]).name;
//Then insert a new one
$("#radios_wrapper").append('<input type="radio" value="'+dataIndex+'" name="'+dataIndex+'" id="radio'+dataIndex+'"/><label for="radio'+dataIndex+'">'+dataName+'</label>');
}
});
这是HTML
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" id='radios_wrapper'>
</fieldset>
</div>
提供演示:[JS Bin](http://jsbin.com/),[jsFiddle](http://jsfiddle.net/)等。 – 2013-03-14 05:04:32
http://jsfiddle.net/w4gQa/1/干得好。 – 2013-03-14 05:22:51