Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

124
Visualizações
Limit HTML date input to today's date

I have an input type date on my form that I limited to only use today's date by setting the min and max attribute to today with the help of javascript. The problem is the user can still type a different date instead of picking it using the little calendar popup. Is there a way to not allow this?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

According to specification min and max shall only affect form submission if violated. GUI behavior is not standardized and therefore does depend on the browser vendor and its specific version. For example, on Chrome 97 I'm not allowed to type the year 2019 in this demo page. As you can see the year text is gray and I'm not allowed to alter it:

enter image description here

You should use a non-native element, to achieve consistent behavior. See for example JQuery DatePicker

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda