Home » Jquery » javascript – jquery change td text

javascript – jquery change td text

Posted by: admin February 22, 2020 Leave a comment

<td>09 Mars 2020</td>

I have a div constructed using the above string.

the Jquery variables that I have

date1 = 09 Mars 2020
date2 = 18 Mars 2020

I just wanted to add content from another date with that date to get a result like that

<td>09 Mars 2020 - 18 Mars 2020</td>

the td that I have on the html page has nothing id nothing name nothing to value there is that the date display and I know it on a variable it misses that like looking for it to find td

    <table class="nobordernopadding" width="100%">
          <td>Date prévue de livraison</td>
          <td align="right"><a href="/commande/card.php?action=editdate_livraison&amp;id=56"><span class="fa fa-pencil marginleftonly valignmiddle pictoedit" style=" color: #444;" alt="Définir la date d'expédition" title="Définir la date d'expédition"></span></a>
  <td>09 Mars 2020</td>
How to&Answer:

Given your provided markup, one possible path for selection is:

    // conditionally filter the td on the desired target text
    .filter(':contains("09 Mars 2020")')
    .text('my new value')