feat(curriculum): make name attribute the same in checkbox group in hotel feedback form workshop (#64212)

This commit is contained in:
majestic-owl448
2025-12-11 13:08:41 +01:00
committed by GitHub
parent e560befe92
commit 7636432e40
15 changed files with 81 additions and 81 deletions
@@ -23,7 +23,7 @@ Here is an example of how to work with checkboxes dealing with food options:
The `value` attribute is used to specify the value that will be sent to the server when the form is submitted.
Below your `legend` element, add a checkbox `input` with the `id`, `name` and `value` attributes set to `"ads"`.
Below your `legend` element, add a checkbox `input` with the `id` and `value` attributes set to `"ads"`, and the `name` attribute set to `"choice"`.
Below your checkbox `input`, add a `label` element with the text `Social Media Ads`. The `for` attribute should be set to `"ads"`.
@@ -41,10 +41,10 @@ Your checkbox `input` should have an `id` attribute set to `"ads"`.
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) legend + input[type='checkbox']")?.id, "ads");
```
Your checkbox `input` should have a `name` attribute set to `"ads"`.
Your checkbox `input` should have a `name` attribute set to `"choice"`.
```js
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) legend + input[type='checkbox']")?.name, "ads");
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) legend + input[type='checkbox']")?.name, "choice");
```
Your checkbox `input` should have a `value` attribute set to `"ads"`.
@@ -7,7 +7,7 @@ dashedName: step-20
# --description--
Add another checkbox `input` with the `id`, `name` and `value` attributes set to `"recommendation"`.
Add another checkbox `input` with the `id`and `value` attributes set to `"recommendation"`, and a `name` attribute set to `"choice"`.
Below the checkbox `input`, add another `label` with the text `Personal Recommendation`. The `for` attribute should be set to `"recommendation"`.
@@ -25,10 +25,10 @@ Your checkbox `input` should have an `id` attribute set to `"recommendation"`.
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) label + input[type='checkbox']")?.id, "recommendation");
```
Your checkbox `input` should have a `name` attribute set to `"recommendation"`.
Your checkbox `input` should have a `name` attribute set to `"choice"`.
```js
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) label + input[type='checkbox']")?.name, "recommendation");
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) label + input[type='checkbox']")?.name, "choice");
```
Your checkbox `input` should have a `value` attribute set to `"recommendation"`.
@@ -107,7 +107,7 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(3) input[type="c
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
--fcc-editable-region--
@@ -7,11 +7,11 @@ dashedName: step-21
# --description--
Next, add another checkbox `input` with the `id`, `name` and `value` attributes set to `"location"`.
Next, add another checkbox `input` with the `id` and `value` attributes set to `"location"`, and the `name` attribute set to `"choice"`.
For the `label` element, the text of `Location` and the `for` attribute should be set to `"location"`.
Below that `label` element, add another checkbox `input` with the `id`, `name` and `value` attributes set to `"reputation"`.
Below that `label` element, add another checkbox `input` with the `id` and `value` attributes set to `"reputation"`, and the `name` attribute set to `"choice"`.
For the `label` element, the text of `Reputation` and the `for` attribute should be set to `"reputation"`.
@@ -29,10 +29,10 @@ Your third checkbox `input` should have an `id` attribute set to `"location"`.
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) input[type='checkbox']:nth-of-type(3)")?.getAttribute('id'), 'location');
```
Your third checkbox `input` should have a `name` attribute set to `"location"`.
Your third checkbox `input` should have a `name` attribute set to `"choice"`.
```js
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) input[type='checkbox']:nth-of-type(3)")?.getAttribute('name'), 'location');
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) input[type='checkbox']:nth-of-type(3)")?.getAttribute('name'), 'choice');
```
Your third checkbox `input` should have a `value` attribute set to `"location"`.
@@ -65,10 +65,10 @@ You should have a fourth checkbox `input` with an `id` attribute set to `"reputa
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) label:nth-of-type(3) + input[type='checkbox']")?.getAttribute('id'), 'reputation');
```
Your fourth checkbox `input` should have a `name` attribute set to `"reputation"`.
Your fourth checkbox `input` should have a `name` attribute set to `"choice"`.
```js
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) label:nth-of-type(3) + input[type='checkbox']")?.getAttribute('name'), 'reputation');
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) label:nth-of-type(3) + input[type='checkbox']")?.getAttribute('name'), 'choice');
```
Your fourth checkbox `input` should have a `value` attribute set to `"reputation"`.
@@ -141,13 +141,13 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(3) input[value="
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
@@ -7,7 +7,7 @@ dashedName: step-23
# --description--
For the final `input` and `label` inside this `fieldset`, you will add a checkbox `input` with the `id`, `name` and `value` attributes set to `"price"`.
For the final `input` and `label` inside this `fieldset`, you will add a checkbox `input` with the `id` and `value` attributes set to `"price"`, and a `name` attribute set to `"choice"`.
Then, a `label` element with the text `Price` and the `for` attribute set to `"price"`.
@@ -27,10 +27,10 @@ Your fifth checkbox `input` should have an `id` attribute set to `"price"`.
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) input[type='checkbox']:nth-of-type(5)")?.getAttribute('id'), 'price');
```
Your fifth checkbox `input` should have a `name` attribute set to `"price"`.
Your fifth checkbox `input` should have a `name` attribute set to `"choice"`.
```js
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) input[type='checkbox']:nth-of-type(5)")?.getAttribute('name'), 'price');
assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) input[type='checkbox']:nth-of-type(5)")?.getAttribute('name'), 'choice');
```
Your fifth checkbox `input` should have a `value` attribute set to `"price"`.
@@ -103,25 +103,25 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(3) input[value="
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
<input
checked
type="checkbox"
id="reputation"
name="reputation"
name="choice"
value="reputation"
/>
<label for="reputation">Reputation</label>
@@ -103,30 +103,30 @@ assert.strictEqual(document.querySelectorAll('fieldset:nth-of-type(4) legend + l
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
<input
checked
type="checkbox"
id="reputation"
name="reputation"
name="choice"
value="reputation"
/>
<label for="reputation">Reputation</label>
<input type="checkbox" id="price" name="price" value="price" />
<input type="checkbox" id="price" name="choice" value="price" />
<label for="price">Price</label>
</fieldset>
@@ -95,30 +95,30 @@ assert.exists(document.querySelector('select[id="service"]'));
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
<input
checked
type="checkbox"
id="reputation"
name="reputation"
name="choice"
value="reputation"
/>
<label for="reputation">Reputation</label>
<input type="checkbox" id="price" name="price" value="price" />
<input type="checkbox" id="price" name="choice" value="price" />
<label for="price">Price</label>
</fieldset>
@@ -140,30 +140,30 @@ assert.strictEqual(document.querySelector('option[value="excellent"]')?.textCont
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
<input
checked
type="checkbox"
id="reputation"
name="reputation"
name="choice"
value="reputation"
/>
<label for="reputation">Reputation</label>
<input type="checkbox" id="price" name="price" value="price" />
<input type="checkbox" id="price" name="choice" value="price" />
<label for="price">Price</label>
</fieldset>
@@ -77,30 +77,30 @@ assert.exists(document.querySelector('option[value="excellent"][selected]'));
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
<input
checked
type="checkbox"
id="reputation"
name="reputation"
name="choice"
value="reputation"
/>
<label for="reputation">Reputation</label>
<input type="checkbox" id="price" name="price" value="price" />
<input type="checkbox" id="price" name="choice" value="price" />
<label for="price">Price</label>
</fieldset>
@@ -91,30 +91,30 @@ assert.exists(document.querySelector('label + select[name="food"]'));
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
<input
checked
type="checkbox"
id="reputation"
name="reputation"
name="choice"
value="reputation"
/>
<label for="reputation">Reputation</label>
<input type="checkbox" id="price" name="price" value="price" />
<input type="checkbox" id="price" name="choice" value="price" />
<label for="price">Price</label>
</fieldset>
@@ -149,30 +149,30 @@ assert.exists(document.querySelector('fieldset:nth-of-type(4) select#food option
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
<input
checked
type="checkbox"
id="reputation"
name="reputation"
name="choice"
value="reputation"
/>
<label for="reputation">Reputation</label>
<input type="checkbox" id="price" name="price" value="price" />
<input type="checkbox" id="price" name="choice" value="price" />
<label for="price">Price</label>
</fieldset>
@@ -77,30 +77,30 @@ assert.strictEqual(document.querySelector('label[for="comments"]')?.textContent.
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
<input
checked
type="checkbox"
id="reputation"
name="reputation"
name="choice"
value="reputation"
/>
<label for="reputation">Reputation</label>
<input type="checkbox" id="price" name="price" value="price" />
<input type="checkbox" id="price" name="choice" value="price" />
<label for="price">Price</label>
</fieldset>
@@ -81,30 +81,30 @@ assert.exists(document.querySelector('label + textarea'));
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
<input
checked
type="checkbox"
id="reputation"
name="reputation"
name="choice"
value="reputation"
/>
<label for="reputation">Reputation</label>
<input type="checkbox" id="price" name="price" value="price" />
<input type="checkbox" id="price" name="choice" value="price" />
<label for="price">Price</label>
</fieldset>
@@ -89,30 +89,30 @@ assert.exists(document.querySelector('textarea[rows="10"]'));
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
<input
checked
type="checkbox"
id="reputation"
name="reputation"
name="choice"
value="reputation"
/>
<label for="reputation">Reputation</label>
<input type="checkbox" id="price" name="price" value="price" />
<input type="checkbox" id="price" name="choice" value="price" />
<label for="price">Price</label>
</fieldset>
@@ -87,30 +87,30 @@ assert.strictEqual(document.querySelector('button')?.textContent.trim(), 'Submit
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
<input
checked
type="checkbox"
id="reputation"
name="reputation"
name="choice"
value="reputation"
/>
<label for="reputation">Reputation</label>
<input type="checkbox" id="price" name="price" value="price" />
<input type="checkbox" id="price" name="choice" value="price" />
<label for="price">Price</label>
</fieldset>
@@ -199,30 +199,30 @@ assert.strictEqual(document.querySelector('button')?.textContent.trim(), 'Submit
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
<input
checked
type="checkbox"
id="reputation"
name="reputation"
name="choice"
value="reputation"
/>
<label for="reputation">Reputation</label>
<input type="checkbox" id="price" name="price" value="price" />
<input type="checkbox" id="price" name="choice" value="price" />
<label for="price">Price</label>
</fieldset>
@@ -77,22 +77,22 @@ assert.exists(document.querySelector("input#reputation[checked]"));
Why did you choose to stay at our hotel? (Check all that apply)
</legend>
<input type="checkbox" id="ads" name="ads" value="ads" />
<input type="checkbox" id="ads" name="choice" value="ads" />
<label for="ads">Social Media Ads</label>
<input
type="checkbox"
id="recommendation"
name="recommendation"
name="choice"
value="recommendation"
/>
<label for="recommendation">Personal Recommendation</label>
<input type="checkbox" id="location" name="location" value="location" />
<input type="checkbox" id="location" name="choice" value="location" />
<label for="location">Location</label>
--fcc-editable-region--
<input type="checkbox" id="reputation" name="reputation" value="reputation" />
<input type="checkbox" id="reputation" name="choice" value="reputation" />
--fcc-editable-region--
<label for="reputation">Reputation</label>
</fieldset>