I need to add links to some divs in Wordpress, so I tried writting some JS code for it. But I keep getting the following error " Uncaught TypeError: addId.setAttribute is not a function "
I'll leave the code down bellow. Thank you everyone for the help
var addId = document.getElementsByClassName("elementor-repeater-item-d7362c2");
addId.setAttribute('id', "item");
ogElement = document.getElementByid("item").innerHTML;
addLink = "<a href='https://www.vivendus.com.br/product-category/colar/'>" + ogElement + "</a>";
document.getElementByid("test").innerHTML = addLink;
.elementor-repeater-item-d7362c2 {
color:#ccff00;
font-size:2em;
}
<div class ='elementor-repeater-item-d7362c2'> test <div>