2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
id: bad87fee1348bd9aedf08829
|
|
|
|
title: Create a Text Field
|
|
|
|
challengeType: 0
|
|
|
|
videoUrl: 'https://scrimba.com/p/pVMPUv/c2EVnf6'
|
2019-07-31 11:32:23 -07:00
|
|
|
forumTopicId: 16823
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: create-a-text-field
|
2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --description--
|
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
Now let's create a web form.
|
2020-11-27 19:02:05 +01:00
|
|
|
|
|
|
|
`input` elements are a convenient way to get input from your user.
|
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
You can create a text input like this:
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
`<input type="text">`
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
Note that `input` elements are self-closing.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --instructions--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
Create an `input` element of type `text` below your lists.
|
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
|
|
|
Your app should have an `input` element of type `text`.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
```js
|
|
|
|
assert($('input[type=text]').length > 0);
|
|
|
|
```
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --seed--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
## --seed-contents--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```html
|
|
|
|
<h2>CatPhotoApp</h2>
|
|
|
|
<main>
|
|
|
|
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
2018-10-08 01:01:53 +01:00
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
2018-10-08 01:01:53 +01:00
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
<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>
|
2018-10-08 01:01:53 +01:00
|
|
|
|
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
</main>
|
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --solutions--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2019-02-06 08:03:30 +05:30
|
|
|
```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>
|
2020-11-27 19:02:05 +01:00
|
|
|
<input type="text">
|
2019-02-06 08:03:30 +05:30
|
|
|
</form>
|
|
|
|
</main>
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|