Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

333
Vistas
How to disable past days and weekends in Jquery

Does anybody know why this Script not working? I am trying to disable weekends and previous dates? I have tried searching all over the web but I am struggling.

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<input type="date" id="date" class="form-control">

<script type="text/javascript">
         $(function() {
         $( "#date" ).datepicker({
         beforeShowDay: $.datepicker.noWeekends
         minDate : 'now'
      });
     });
 </script>

DatePicker

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

According to documentation, you simply need to disable the days of the week by utilizing numbers 0-6. Sunday starting at 0 and Saturday ending at 6, and obviously, every other day of the week assigned accordingly. Also, the format of daysOfWeekDisabled is a comma delimited string which you will see below. In order to only show today's date and on, simply set a minDate of today's date. All of the above is implemented in code below:

let dateToday = new Date(); 

 $('#date').datepicker({
            daysOfWeekDisabled: '0, 6',
            minDate: dateToday
        })
about 4 years ago · Juan Pablo Isaza Denunciar

0

In your case, the problem is you have input type as date but if you change that to test it will work.

Working Example:

<html xmlns="http://www.w3.org/1999/xhtml">
    <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" />
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<head>
    <script type="text/javascript">
        $(function () {
            $("#date").datepicker({
                beforeShowDay: $.datepicker.noWeekends,
                minDate : 'now'
            });
        });
    </script>
</head>
<body>
    <input type="text" id="date" />
</body>
</html>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda