开发者

Link for list item doesn't work

I want to cr开发者_高级运维eate a link on this list item. Why is this method not working?

#jQuery(function(){     
var theList = jQuery('#someList'); 
var content = jQuery('<a href="Settings"><li id="content'+i+'"></li><a/>' 
theList.append(content);        


you need to refresh the list:

theList.append(content).listview('refresh');

UPDATE: Your Code

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'); 
});


You seem to be missing parentheses from your code, try this?

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); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜