【发布时间】:2013-03-02 08:18:58
【问题描述】:
每次用户访问标签菜单时,我都会尝试刷新单选按钮列表。首次访问样式还可以,但它们的行为类似于复选框,并且在单击其他单选按钮时无法取消选中。
我尝试过使用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>
【问题讨论】:
标签: css jquery-mobile radio-button