【发布时间】:2019-08-19 16:47:08
【问题描述】:
当<input class="boton" type="checkbox"> 改变时,从<input type='date' id='fechai' name='fechai' class='fechai'> 获取值并使用ajax 在<input type="date" id="fechai-cambio" name="fechai5"> 上显示它。可以包含 jquery。
我已经尝试了多种方法,但我只能让它显示在警报中......我将它们都发布在下面以防万一,因为第二个会在一段时间内显示。我需要在所有已选中的框中显示第一个日期。
$('.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>";
【问题讨论】: