Ashraf Nazar 71051fef50
fix(Curriculum): make sure the nested input element in the form is th… (#38480)
* fix(Curriculum): make sure the nested input element in the form is the existing element given in the editor

* Update curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-form-element.english.md

Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>

* Update curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-form-element.english.md

Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>

* Update curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-form-element.english.md

Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>

* Update curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-form-element.english.md

Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>

* Update curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-form-element.english.md

Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>

* fix: use backticks to avoid linting error

Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
Co-authored-by: Randell Dawson <rdawson@onepathtech.com>
2020-08-30 22:50:46 -07:00

2.7 KiB

id, title, challengeType, isHidden, videoUrl, forumTopicId
id title challengeType isHidden videoUrl forumTopicId
bad87fee1348bd9aede08830 Create a Form Element 0 false https://scrimba.com/p/pVMPUv/cmQ3Kfa 16817

Description

You can build web forms that actually submit data to a server using nothing more than pure HTML. You can do this by specifying an action on your form element. For example: <form action="/url-where-you-want-to-submit-form-data"></form>

Instructions

Nest the existing input element inside a form element and assign "https://freecatphotoapp.com/submit-cat-photo" to the action attribute of the form element.

Tests

tests:
  - text: The existing <code>input</code> element should be nested within a <code>form</code> element.
    testString: const inputElem = document.querySelector('form input'); assert(inputElem.getAttribute('type') === 'text' && inputElem.getAttribute('placeholder') === 'cat photo URL');
  - text: Your <code>form</code> should have an <code>action</code> attribute which is set to <code>https://freecatphotoapp.com/submit-cat-photo</code>
    testString: assert($("form").attr("action") === "https://freecatphotoapp.com/submit-cat-photo");
  - text: Your <code>form</code> element should have 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);

Challenge Seed

<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>

Solution

<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="https://freecatphotoapp.com/submit-cat-photo">
    <input type="text" placeholder="cat photo URL">
  </form>
</main>