I have an array of objects:
comment: "https://www.facebook.com/groups/2388163605/permalink/10151045693478606/"
comments: Array[1]
created: "48 minuter sen"
img: "http://graph.facebook.com/589136752/picture"
link: "http://www.facebook.com/589136752"
message: "gbg - sthlm 31/7. finnes: 3 platser. 0703 05 45 65"
name: "Jack Johansson"
sortvar: 1342676288
Using this Array and mustache. I generate a list of html list-elements. However I don’t use the “Name” variable. It’s in there for a debug function. When the debug is run I want to add/append the name-variable to the beginning of it’s equivalent list-node. What is a good way of doing this? I would prefer to not create a new template in mustache.
I believe the solution is something like:
foreach(item in array){
$(li).append('<p>'+item.name+'</p>');
}
But this will add the item.name all list items. I want to add the first item.name to the first list item, and the second item.name to the second etc.
I dont understand Mustache,
If you want to add Name attribute to an Js Object only while debugging some logic like,
can be used, again I am totally unaware of mustache.
Do you want something like:
Just saw your update, still not exactly sure of what you want, this just demonstrates selecting nth li for nth element.