When <input class="boton" type="checkbox">
is changed, get value from <input type='date' id='fechai' name='fechai' class='fechai'>
and show it on <input type="date" id="fechai-cambio" name="fechai5">
with ajax. Can include jquery.
Ive tried multiple things but I can only get it to show on the alert.... I posted both of them below just in case because the second one is shown within a while. I need for the first date to show in all the boxes that have been checked.
$('.boton').change(function () {
var fechai = new Date($('#fechai').val());
$.ajax({
type: 'post',
data: {fechai:fechai},
success: function(response){
//Show the var fechai in the #fechai-cambio
alert(fechai);
}
});
});
<label for='superv' >Nombre de Equipo</label>
<select name='superv' id='superv'>
'<option></option>'";
while($row = mysqli_fetch_array($superv))
{
echo "<option value='$row[IDSUPERVISOR]'>$row[NOMEQUIPO]</option>";
}
echo" </select>
<label for='cantp' >Cantidad de Personas</label>
<input type='text' id='cantp' name='cantp' readonly>
<label for='razon' >Fecha Inicio</label>
<input type='date' id='fechai' name='fechai' class='fechai' >
<br>";
while($row = mysqli_fetch_array($result)){
echo ' <tr>
<td>'.$row['NOMBRE'].' '.$row['APELLIDO_P'].'</td>
<td class="text-center"><input class="boton" type="checkbox" name="checkbox[]" value="'.$row['IDLIBRETA_PERSONAL'].'"></td>
<td><input type="date" id="fechai-cambio" name="fechai5" ></td>
<td>'.$row['NOMBRE'].'</td>
</tr>';
}
echo "<button id='btn_form' type='button' onclick='realizaGrupo()'>Grabar</button>";
答案 0 :(得分:0)
我不为什么您要使用AJAX。您可以在其中简单地通过jquery做到这一点
$('.boton').change(function () {
var fechai = $('#fechai').val();
$('#fechai-cambio').val(fechai);
});