I'm having some trouble dynamically changing the background field within the .tracking-list li a:before css for each a I'm looping through.
As an example I was able to change the background to "red" below and the name, but I'm unsure how to change the specific field "background" within .tracking-list li a:before.
Any suggestions on how I can dynamically change this? Thanks so much!
style.css
.tracking-list li a:before {
content: "";
background: url("../images/bitmap.svg") no-repeat;
display: inline-block;
width: 22px;
height: 20px;
margin-right: 4px;
vertical-align: middle;
}
JS
//Loop Through Names
var ul = document.getElementById(category);
for (var i = 0; i < data.data.length; i++) {
let record = data.data[i];
let tech_name = record.name;
let logo_image = record.logo;
var listItem = document.createElement("a");
listItem.textContent = tech_name;
listItem.style.background = "red";
ul.appendChild(listItem);
}