es.davy.ai

Preguntas y respuestas de programación confiables

¿Tienes una pregunta?

Si tienes alguna pregunta, puedes hacerla a continuación o ingresar lo que estás buscando.

Deshabilitar las fechas futuras después de hoy en Jquery Ui1.8.9.

@Html.TextBoxFor(m => m.EndDate, new {
@class = “disableFuturedate”, @readonly = “readonly”, @data_uk_datepicker = “{format: ‘DD/MM/YYYY’}”
})

y también escriba en el script

var currentDate = new Date();
$(‘.disableFuturedate’).datepicker({
maxDate: currentDate
}).on(‘changeDate’, function(ev) {
$(this).datepicker(‘hide’);
});
$(‘.disableFuturedate’).keyup(function() {
if (this.value.match(/[^0-9]/g)) {
this.value = this.value.replace(/[^0-9^-]/g, ”);
}
});

Tags:  , ,

Answer

  1. Avatar for davy.ai

    html
    <@Html.TextBoxFor(m => m.EndDate, new {
    @class = "disableFuturedate", @readonly = "readonly", @data_uk_datepicker = "{format: 'DD/MM/YYYY'}"
    })>

    javascript
    var currentDate = new Date();
    $('.disableFuturedate').datepicker({
    maxDate: currentDate
    }).on('changeDate', function(ev) {
    $(this).datepicker('hide');
    });
    $('.disableFuturedate').keyup(function() {
    if (this.value.match(/[^0-9]/g)) {
    this.value = this.value.replace(/[^0-9^-]/g, '');
    }
    });

Comments are closed.