I am printing in the html an information that comes from php with multiple records, using a foreach; but I would like to obtain from all the records "values" that come in the td field with the id="DateRegistro" using jquery, but I don't have the slightest idea of how it can be done, how could it be done?
<tr>
<td>#<?php echo $datax->Codigo; ?></td>
<td><i class="fa fa-user"></i> <?php echo $datax->PrimerNombre." ".$datax->PrimerApellido." [ ".$datax->NombreCompleto." ]"; ?></td>
<td id="FechaRegistro"> <?php echo $datax->FechaSolicitud; ?></td>
</tr>
Try to do it in the following way but I only take the last record:
$('#FechaRegistro').each(function(index){
console.log(index + " : " + $(this).text());
})
You can't use the same one
id
for different elements. You need to use a class like this:The IDs are overridden and only one remains (the idea is that they are unique), so instead of using IDs, use classes.
and to loop through it use