jquery移动复选框失去风格 [英] jquery mobile checkbox loses style
本文介绍了jquery移动复选框失去风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我使用jqm和phonegap写简单的应用程序,我有一些问题与复选框:他们失去风格后,我添加一些代码与.append()这是我的代码。
in .html:
Hi i write simple app using jqm and phonegap, and i have some problem with checkbox: they are loses style after i add some code with .append() this is my code. in .html:
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" id="vklConf">
<legend>Deposit:</legend>
<input type="checkbox" name="checkbox-1a" id="checkbox-1a" class="custom" />
<label for="checkbox-1a">first</label>
</fieldset>
</div>
和.js:
function upbConfDep(){
mydb.transaction
(
function(transaction)
{
transaction.executeSql
(
'SELECT `id`, `name` FROM `deposits` WHERE `userId`='+userId+' ORDER BY `name`;',
[],
function (transaction, results)
{
var depostitNumber=results.rows.length,nowRow;
if (results.rows.length>0)
{
for(var i=0;i<depostitNumber;i++)
{
dps=results.rows.item(i);
$('#vklConf').append('<input type="checkbox" name="ch'+dps['id']+'" id="ch'+dps['id']+'" class="custom" />');
$('#vklConf').append('<label for="ch'+dps['id']+'">');
$('#vklConf').append(dps['name']);
$('#vklConf').append('</label>');
}
}
},
DBerror
);
}
);
$("#vklConf").checkboxradio('refresh');
//or $("input[type='checkbox']").checkboxradio("refresh"); dosn`t work
}
upbConfDep();
$('#newPrize').live
(
'pageinit',
upbConfDep
);
<
任何人都有想法为什么checkbox会失去风格??
using .checkboxradio("refresh") dosn`t work. Do anyone have ideas why checkbox lose style ??
推荐答案
/ p>
Run this code after you are done appending to page
$(".ui-page").trigger( "create" );
示例: http://jsfiddle.net/codaniel/hY7TQ/1/
这篇关于jquery移动复选框失去风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文