我想在此列表项上创建一个链接。为什么这种方法不起作用?
#jQuery(function(){
var theList = jQuery('#someList');
var content = jQuery('<a href="Settings"><li id="content'+i+'"></li><a/>'
theList.append(content);
答案 0 :(得分:1)
您需要刷新列表:
theList.append(content).listview('refresh');
更新:您的代码
jQuery(function(){
var theList = jQuery('#someList');
for(i=0; i < mytool_array.length; i++) {
content = '<li id="content'+i+'"><a href="dgdfg"></a></li>';
theList.append(content);
}
theList.listview('refresh');
});
答案 1 :(得分:0)
您的代码中似乎缺少括号,试试这个吗?
var theList = $('#someList'),
i = 0, // i isn't defined in the code you displayed, is it in a loop by chance?
content = '<li id="content' + i + '"><a href="Settings">Put Something Here</a></li>';
theList.append(content);