• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

170
Vistas
How to not change value if an input is empty

I have written this code for a form I was working on.

<div class="col-md-6"><label class="labels">Doğum Günü:</label><input method="POST"name="birtdate" class="form-control" {% if student.birtdate%} type="text"value="{{student.birtdate}}" onfocus="(this.type='date')"onblur="(this.type='text')" {%else %}type="date" {% endif %}></div></div>

It should show the initial value when blur and turn into a date field when focused. The problem is when I click on it and then click away it shows an empty value. I need to somehow check that and make it not change the value if the input is empty. How can I do that?

almost 3 years ago · Juan Pablo Isaza
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 Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda