Listgroup1.addItem with a badge?


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

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

I have tried things like Listgroup.addItem(“”, “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,

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: