mike643
mike643

Reputation: 829

Link for list item doesn't work

I want to create 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);        

Upvotes: 0

Views: 246

Answers (2)

Phill Pafford
Phill Pafford

Reputation: 85318

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

Upvotes: 1

Jimmy
Jimmy

Reputation: 9815

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

Upvotes: 0

Related Questions