freeCodeCamp/curriculum/challenges/spanish/01-responsive-web-design/basic-html-and-html5/create-a-form-element.spani...

2.3 KiB

id title challengeType videoUrl localeTitle
bad87fee1348bd9aede08830 Create a Form Element 0 Crear un elemento de formulario

Description

Puede crear formularios web que envíen datos reales a un servidor usando nada más que HTML. Puedes hacerlo especificando un action en tu elemento form . Por ejemplo: <form action="/url-where-you-want-to-submit-form-data"></form>

Instructions

Anida el campo de texto dentro de un elemento form y agrega el atributo action="/submit-cat-photo" al elemento formulario.

Tests

tests:
  - text: Anida el elemento de entrada de texto dentro de un elemento de <code>form</code> .
    testString: 'assert($("form") && $("form").children("input") && $("form").children("input").length > 0, "Nest your text input element within a <code>form</code> element.");'
  - text: Asegúrese de que su <code>form</code> tenga un atributo <code>action</code> y cuyo valor sea <code>/submit-cat-photo</code>
    testString: 'assert($("form").attr("action") === "/submit-cat-photo", "Make sure your <code>form</code> has an <code>action</code> attribute which is set to <code>/submit-cat-photo</code>");'
  - text: Asegúrese de que su elemento <code>form</code> tenga las etiquetas de apertura y cierre bien formadas.
    testString: 'assert(code.match(/<\/form>/g) && code.match(/<form [^<]*>/g) && code.match(/<\/form>/g).length === code.match(/<form [^<]*>/g).length, "Make sure your <code>form</code> element has well-formed open and close tags.");'

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

// solution required