I am working on creating a list of html elements using JavaScript.
Each element has an image and several lines of descriptive text, the code appears as such:
for (var i=0; i < json.length; i++){
var section = document.createElement('section');
var item = document.createElement('h1');
var img = document.createElement('img');
var datasheet = document.createElement('h3');
item.textContent = "name: " + json[i][7];
img.src="../cap/images/placeholder.png";
datasheet.textContent= "../datasheet/test.pdf";
section.appendChild(img);
section.appendChild(item);
section.appendChild(datasheet)
body.append(section);
}
What tag can I use to turn the datasheet text into a link in html?
I have tried DOM tags such as : 'datasheet.link=', 'datasheet.href=' neither which work.