Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

64
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?

7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos