--- id: bad87fee1348bd9aede08830 title: Criar um elemento de formulário challengeType: 0 forumTopicId: 16817 dashedName: create-a-form-element --- # --description-- Você pode criar formulários que enviam dados a um servidor usando apenas HTML puro. Você pode fazer isso especificando o atributo `action` ao elemento `form`. Por exemplo: ```html
``` # --instructions-- Coloque o elemento `input` que já existe dentro de um elemento `form` e insira `"https://www.freecatphotoapp.com/submit-cat-photo"` no atributo `action` do elemento `form`. # --hints-- O elemento `input` existente deve ficar dentro do elemento `form`. ```js const inputElem = document.querySelector('form input'); assert( inputElem.getAttribute('type') === 'text' && inputElem.getAttribute('placeholder') === 'cat photo URL' ); ``` O elemento `form` deve ter o atributo `action` definido como `https://www.freecatphotoapp.com/submit-cat-photo`. ```js const action = $('form').attr('action'); assert(action.match(/^https:\/\/(www\.)?freecatphotoapp\.com\/submit-cat-photo$/i)) ``` O elemento `form` deve ter as tags de abertura e fechamento corretas. ```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
```