I am adding some list elements programmatically into a list, where every item has an image instead of a bullet. For that, I need to change also the image programmatically.
How can I set the url image path of the property 'background-image' from the li:before?
The css list properties look as:
ul.fileList {
background-color: white;
list-style: none;
}
ul.fileList > li:before {
content: '';
display: inline-block;
background-size: 30px;
background-image: url('/Resources/imageFileIcon.png');
background-repeat: no-repeat;
}
I am adding the list items as:
for (var i = 0; i < files.length; i++) {
$("ul.fileList").append("<li><a href='#'>" + files[i] + "</a></li>");
//how to set the background-image: url()??
}