--- id: bad87fee1348bd9aede08830 title: Creare un modulo challengeType: 0 forumTopicId: 16817 dashedName: create-a-form-element --- # --description-- Puoi creare dei moduli web (form) che inviino effettivamente dei dati a un server utilizzando nient'altro che puro HTML. Puoi farlo specificando un attributo `action` nel tuo elemento `form`. Ad esempio: ```html
``` # --instructions-- Nidifica l'elemento `input` esistente all'interno di un elemento `form` e assegna `"https://www.freecatphotoapp.com/submit-cat-photo"` all'attributo `action` dell'elemento `form`. # --hints-- L'elemento `input` esistente dovrebbe essere annidato in un elemento `form`. ```js const inputElem = document.querySelector('form input'); assert( inputElem.getAttribute('type') === 'text' && inputElem.getAttribute('placeholder') === 'cat photo URL' ); ``` Il tuo `form` dovrebbe avere un attributo `action` impostato su `https://www.freecatphotoapp.com/submit-cat-photo`. ```js const action = $('form').attr('action'); assert(action.match(/^https:\/\/(www\.)?freecatphotoapp\.com\/submit-cat-photo$/i)) ``` Il tuo elemento `form` dovrebbe avere tag di apertura e di chiusura ben formati. ```js assert( code.match(/<\/form>/g) && code.match(/
/g) && code.match(/<\/form>/g).length === code.match(//g).length ); ``` # --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
```