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

161
Vistas
How to change text in table column using javascript

I have this code in my website is there any way to change text inside (td) tag in table using javascript

<div id="mvctable">
    <table width="100%">
        <tbody>
            <tr>
                <td style="font-size:2; text-align:Right;color:#ffffff;">
                    <img src="https://babilsport.com/wp-content/plugins/mechanic-visitor-counter/counter/mvcvisit.png"> Visit Today : 1
                </td>
            </tr>
            <tr>
                <td style="font-size:2; text-align:Right;color:#ffffff;">
                    <img src="https://babilsport.com/wp-content/plugins/mechanic-visitor-counter/counter/mvcmonth.png"> This Month : 1
                </td>
            </tr>
            <tr>
                <td style="font-size:2; text-align:Right;color:#ffffff;">
                    <img src="https://babilsport.com/wp-content/plugins/mechanic-visitor-counter/counter/mvctotal.png"> Total Visit : 1
                </td>
            </tr>
        </tbody>
    </table>
</div>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to find the td node you want to change via javascript. The most direct is to add an unique id attribute to the td you want to edit. Then use .textContent to set it.

document.getElementById("uniqueIdHere").textContent="newtext";

If you can't add unique ids then you will need to find via a known position or via the existing text in the td tag.

firstTD = document.getElementById("mvctable").querySelector('td');
firstTD.textContent="newtext";

You could get all of the TDs and loop through

tdElements = document.getElementById("mvctable").getElementsByTag('td');
for(var i = 0; i < tdElements.length; i++){
//do something to each td like
   tdElements[i].textContent = "something new...";
}

Need more info to give you more details.

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