I am attempting to use JavaScript to generate a div with an image on the left and text that can dynamically switch on the right side.
What I envision is something like this: [IMAGE] "text"
Currently, my attempt has resulted in the text showing up below the image. Any help would be greatly appreciated.
let img = document.createElement("img");
img.src = "https://via.placeholder.com/50";
img.id = "icon"
img.style.display = "flex";
img.style.alignItems = "center";
img.setAttribute("height", "76.8");
img.setAttribute("width", "76.8");
let textSpan = document.createElement("span")
textSpan.id = "Count"
textSpan.style.padding = "10px"
textSpan.innerHTML = "x0"
let CountDiv = document.createElement('div')
CountDiv.id = "CountDiv"
CountDiv.style.position = 'absolute';
CountDiv.style.top = 400 + 'px';
CountDiv.style.left = 200 + 'px';
CountDiv.style.background = "white"
CountDiv.append(img)
CountDiv.append(textSpan)
document.body.appendChild(CountDiv)