Ir para o conteúdo
document.addEventListener("DOMContentLoaded", function () {
fetch('https://api.exchangerate.host/latest?base=USD&symbols=BRL')
.then(response => response.json())
.then(data => {
const valor = data.rates.BRL.toFixed(2);
const container = document.getElementById('cotacao-dolar');
if (container) {
container.innerHTML = "💵 Dólar hoje: R$ " + valor;
}
})
.catch(error => {
console.error('Erro ao buscar a cotação:', error);
});
});