Listgroup1.addItem with a badge?

Hi,

I load a list of saved files into an empty Listgroup with Listgroup.addItem(file.name);

At the same time I need to set the text for the badges which will be dates.

I have tried things like Listgroup.addItem(“file.name”, “badge text”) but the badges don’t work.

Any help with this?

The supplied addItem function does not do this. You’ll need to do some code.

I managed it with this,
Example:

var myContent = "List Item Content Text"
var myBadge = "Badge Text"
Listgroup2.addItem(myContent + "<span class=badge style=color:white>" + myBadge + "</span>")

The three ticks (````) go at the beginning and end of the block, not on each line. :slight_smile: