Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

159
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!