2018-10-10 18:03:03 -04:00
---
id: bad87fee1348bd9aede08830
title: Create a Form Element
challengeType: 0
2019-08-28 16:26:13 +03:00
videoUrl: https://scrimba.com/p/pVMPUv/cmQ3Kfa
forumTopicId: 16817
2018-10-10 18:03:03 -04:00
localeTitle: Создание элемента формы
---
## Description
2019-08-28 16:26:13 +03:00
< section id = 'description' >
Вы можете создавать веб-формы, которые фактически отправляют данные на сервер, используя не что иное, как чистый HTML. Вы можете сделать это, указав действие в элементе < code > form< / code > . Например: < code > < form action=" /url-where-you-want-to-submit-form-data" > < /form> < / code >
< / section >
2018-10-10 18:03:03 -04:00
## Instructions
2019-08-28 16:26:13 +03:00
< section id = 'instructions' >
Заглушите свое текстовое поле внутри элемента < code > form< / code > и добавьте атрибут < code > action=" /submit-cat-photo" < / code > в элемент формы.
< / section >
2018-10-10 18:03:03 -04:00
## Tests
< section id = 'tests' >
```yml
tests:
2019-08-28 16:26:13 +03:00
- text: Nest your text input element within a < code > form</ code > element.
testString: assert($("form") & & $("form").children("input") & & $("form").children("input").length > 0);
- text: Make sure your < code > form</ code > has an < code > action</ code > attribute which is set to < code > /submit-cat-photo</ code >
testString: assert($("form").attr("action") === "/submit-cat-photo");
- text: Make sure your < code > form</ code > element has well-formed open and close tags.
testString: assert(code.match(/< \/form > /g) && code.match(/< form [^<]* > /g) && code.match(/< \/form > /g).length === code.match(/< form [^<]* > /g).length);
2018-10-10 18:03:03 -04:00
```
< / section >
## Challenge Seed
< section id = 'challengeSeed' >
< div id = 'html-seed' >
```html
< h2 > CatPhotoApp< / h2 >
< main >
< p > Click here to view more < a href = "#" > cat photos< / a > .< / p >
< a href = "#" > < img src = "https://bit.ly/fcc-relaxing-cat" alt = "A cute orange cat lying on its back." > < / a >
< p > Things cats love:< / p >
< ul >
< li > cat nip< / li >
< li > laser pointers< / li >
< li > lasagna< / li >
< / ul >
< p > Top 3 things cats hate:< / p >
< ol >
< li > flea treatment< / li >
< li > thunder< / li >
< li > other cats< / li >
< / ol >
< input type = "text" placeholder = "cat photo URL" >
< / main >
```
< / div >
< / section >
## Solution
< section id = 'solution' >
2019-08-28 16:26:13 +03:00
```html
< h2 > CatPhotoApp< / h2 >
< main >
< p > Click here to view more < a href = "#" > cat photos< / a > .< / p >
< a href = "#" > < img src = "https://bit.ly/fcc-relaxing-cat" alt = "A cute orange cat lying on its back." > < / a >
< p > Things cats love:< / p >
< ul >
< li > cat nip< / li >
< li > laser pointers< / li >
< li > lasagna< / li >
< / ul >
< p > Top 3 things cats hate:< / p >
< ol >
< li > flea treatment< / li >
< li > thunder< / li >
< li > other cats< / li >
< / ol >
< form action = "/submit-cat-photo" >
< input type = "text" placeholder = "cat photo URL" >
< / form >
< / main >
2018-10-10 18:03:03 -04:00
```
2019-08-28 16:26:13 +03:00
2018-10-10 18:03:03 -04:00
< / section >