I tried console.log() to see if zoomName has a value, and it does. However, I was trying to see if setAttribute() worked in the function by console logging the id of the div I just created and it said it's unidentified. How do I set attribute in this case? Thanks!
var zoomNum = 0;
function appendImg(imgName){
zoomNum+=1;
var zoomName = zoomNum.toString(); //create id name for new zoom class
zoomName = "zoomId" + zoomName;
var newZoomClass = document.createElement("div"); //create new zoom class for each image
newZoomClass.setAttribute("class", "zoom");
newZoomClass.setAttribute("id", zoomName); //new ID
document.getElementsByClassName("infoContent")[0].appendChild(newZoomClass); //append class to infoContent
var linkk = document.getElementsByClassName("zoom");
var theValue = linkk.getAttribute("id");
console.log(theValue);