--- id: bad87fee1348bd9aedc08830 title: Usa HTML5 para requerir un campo challengeType: 0 videoUrl: 'https://scrimba.com/p/pVMPUv/cMd4EcQ' forumTopicId: 18360 dashedName: use-html5-to-require-a-field --- # --description-- Puedes requerir campos específicos de un formulario para que tu usuario no pueda enviarlo hasta que no los haya rellenado. Por ejemplo, si deseas hacer obligatorio un campo de entrada de texto, puedes agregar el atributo `required` dentro de tu elemento `input`, de esta forma: `` # --instructions-- Convierte tu entrada de texto `input` en un campo obligatorio `required` para que tu usuario no pueda enviar el formulario sin completar este campo. Luego intenta enviar el formulario sin introducir ningún texto. ¿Ves cómo tu formulario HTML5 te notifica que el campo es obligatorio? # --hints-- Tu elemento de entrada de texto `input` debe tener el atributo `required`. ```js assert($('input').prop('required')); ``` # --seed-- ## --seed-contents-- ```html

CatPhotoApp

Click here to view more cat photos.

A cute orange cat lying on its back.

Things cats love:

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
``` # --solutions-- ```html

CatPhotoApp

Click here to view more cat photos.

A cute orange cat lying on its back.

Things cats love:

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
```