[英]Get value from input date and show in the another input date by ajax
當<input class="boton" type="checkbox">
更改時,從<input type='date' id='fechai' name='fechai' class='fechai'>
並在<input type="date" id="fechai-cambio" name="fechai5">
with ajax。 可以包括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>";
我不是你想要使用AJAX的原因。 你可以用jquery簡單地做到這一點
$('.boton').change(function () {
var fechai = $('#fechai').val();
$('#fechai-cambio').val(fechai);
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.