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

500
Views
¿Cómo seleccionar y cambiar el valor de la celda de la tabla con jQuery?

¿Cómo cambio el contenido de la celda que contiene la letra 'c' en la muestra HTML usando jQuery?

 <table id="table_header"> <tr> <td>a</td> <td>b</td> <td>c</td> </tr> </table>

Gracias.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

$("td:contains('c')").html("new");

o, más precisamente $("#table_headers td:contains('c')").html("new");

y tal vez para reutilizar podrías crear una función para llamar

 function ReplaceCellContent(find, replace) { $("#table_headers td:contains('" + find + "')").html(replace); }
over 4 years ago · Santiago Trujillo Report

0

Usando eq() puede apuntar a la tercera celda de la tabla:

 $('#table_header td').eq(2).html('new content');

Si desea apuntar a cada tercera celda en cada fila, use el nth-child-selector :

 $('#table_header td:nth-child(3)').html('new content');
over 4 years ago · Santiago Trujillo Report

0

Puede utilizar selectores de CSS .

Dependiendo de cómo obtenga ese td, puede darle una identificación:

 <td id='cell'>c</td>

y luego usa:

 $("#cell").text("text");

O vaya a la tercera celda de la primera fila de table_header, etc.

over 4 years ago · Santiago Trujillo 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!