Estoy obteniendo datos de la empresa, como el logotipo, el título de la empresa, la descripción y el sitio web. Cuando aparece el sitio web, es una cadena de texto normal. Me gustaría que apareciera en el navegador como un enlace en el que se puede hacer clic.
function getCompanyProfile(symbol) { const url = `https://.appspot.com/api/v3/company/profile/${symbol}`; fetch(url) .then((response) => response.json()) .then((data) => { const profile = data.profile; companyTitle.textContent = profile.companyName; companyWebsite.textContent = profile.website; companyDescription.textContent = profile.description; price.textContent = "Stock Price: $" + profile.price; let profileChangesPercent = Number(profile.changesPercentage); if (profileChangesPercent >= 0) { changesPercentage.classList.add("green"); } else if (profileChangesPercent < 0) { changesPercentage.classList.add("red"); } changesPercentage.textContent = profileChangesPercent.toFixed(2) + "%"; // set logo let img = document.createElement("img"); img.src = profile.image; companyLogo.appendChild(img); console.log(data); }) .catch((err) => { console.warn("Something went wrong.", err.message); }); }Puede cambiar companyWebsite.textContent = profile.website; to companyWebsite.innerHTML = "<a href='" + profile.website + "'>Hyperlink Text</a>"