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

160
Visualizações
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 Respostas
Responde à pergunta

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 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