Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

130
Visualizações
I want to change text from table to a link

I wanted to change the value of attachment in the table to a clickable link because the links are very long, i got the link from Firebase firestore and i wanted to change it to a clickable link

this is the JavaScript file

var attendantNumber = 0;
var tbody = document.getElementById('tbody1');

function AddItemToTable(fname, lname, email, phoneNumber, country, attachment){

    let trow = document.createElement('tr');
    let td1 = document.createElement('td');
    let td2 = document.createElement('td');
    let td3 = document.createElement('td');
    let td4 = document.createElement('td');
    let td5 = document.createElement('td');
    let td6 = document.createElement('td');
    let td7 = document.createElement('td');

    td1.innerHTML = ++attendantNumber;
    td2.innerHTML = fname;
    td3.innerHTML = lname;
    td4.innerHTML = email;
    td5.innerHTML = phoneNumber;
    td6.innerHTML = country;
    td7.innerHTML = attachment;

    trow.appendChild(td1);
    trow.appendChild(td2);
    trow.appendChild(td3);
    trow.appendChild(td4);
    trow.appendChild(td5);
    trow.appendChild(td6);
    trow.appendChild(td7);
    tbody.appendChild(trow);
}

function AddAllItemsToTable(TheAttendant) {
    attendantNumber = 0;
    tbody.innerHTML = "";
    TheAttendant.forEach(element => {
        AddItemToTable(element.FirstName, element.LastName, element.Email, element.PhoneNumber, element.Country, element.attachment);
    });  
}


async function GetAllData() {
    const querySnapshot = await getDocs(collection(db, "attendants"));
    var attendants = [];
    querySnapshot.forEach(doc => {
        attendants.push(doc.data());
    });

    AddAllItemsToTable(attendants);
}

window.onload = GetAllData;
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Your innerHTMl then needs to be a link. Something like

td7.innerHTML = '<a href="https://www.google.com">'+attachment+'</a>';
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda