I have been trying to figure out how to dynamically change a href link after a search query is submitted. Here is an example below
for ( i = 0; i < res.listings.length; i++) {
document.getElementsByClassName("title")[i].innerHTML = (res.listings[i].title);
}
This is an example that works perfectly fine for me and changes the title of the listings, but I also want to update the links that are within the title.
document.getElementsByClassName("title")[i].href = (res.listings[i]._links.web.href);
This does not work and I am having trouble finding any documentation on accessing links by getElement.
<div class="title reset"><a href=""></a>Title Goes Here</a></div>
This is the div class it is targeting.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…