Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

121
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda