fix(curriculum): add value attribute instruction for hotel feedback radios (#65686)

This commit is contained in:
Jeevankumar S
2026-02-04 14:08:41 +05:30
committed by GitHub
parent 632289c7f0
commit 91b9c93c23
18 changed files with 55 additions and 37 deletions
@@ -20,7 +20,7 @@ Here is an example of two radio buttons:
In this example, the radio buttons are grouped together by using the same `name` attribute value. This means that only one radio button can be selected at a time.
Below your `legend` element, add a `radio` button with the `id` set to `"yes-option"`, and the `name` attribute set to `"hotel-stay"`.
Below your `legend` element, add a `radio` button with the `id` set to `"yes-option"`, the `name` attribute set to `"hotel-stay"`, and a `value` attribute set to `"yes"`.
Below your `radio` button, add a `label` element with the text `Yes` and a `for` attribute set to `"yes-option"`.
@@ -44,6 +44,15 @@ Your `radio` button should have a `name` attribute set to `"hotel-stay"`.
assert.strictEqual(document.querySelector('fieldset:nth-of-type(2) legend + input[type="radio"]')?.name, 'hotel-stay');
```
Your radio button should have a `value` attribute set to `"yes"`.
```js
assert.strictEqual(
document.querySelector('fieldset:nth-of-type(2) legend + input[type="radio"]')?.value,
'yes'
);
```
You should have a `label` element below your `radio` button.
```js
@@ -7,7 +7,7 @@ dashedName: step-17
# --description--
Below your `label` element, add a `radio` button with the `id` set to `"no-option"`, and the name attribute set to `"hotel-stay"`.
Below your `label` element, add a `radio` button with the `id` set to `"no-option"`, the `name` attribute set to `"hotel-stay"`, and a `value` attribute set to `"no"`.
Below your new `radio` button, add another `label` element with the `for` attribute set to `"no-option"`. The text for the `label` should be `No`.
@@ -39,6 +39,15 @@ Your `input` element should have a `name` attribute of `"hotel-stay"`.
assert.strictEqual(document.querySelector('fieldset:nth-of-type(2) label + input')?.name, 'hotel-stay');
```
Your input element should have a `value` attribute set to `"no"`.
```js
assert.strictEqual(
document.querySelector('fieldset:nth-of-type(2) label + input')?.value,
'no'
);
```
You should have a second `label` element below your second `input` element.
```js
@@ -97,7 +106,7 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(2) input:nth-of-
</fieldset>
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
--fcc-editable-region--
@@ -74,9 +74,9 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(3) legend')?.inn
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -112,9 +112,9 @@ assert.strictEqual(document.querySelector("fieldset:nth-of-type(3) input[type='c
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -96,9 +96,9 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(3) input[type="c
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -130,9 +130,9 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(3) input[value="
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -92,9 +92,9 @@ assert.strictEqual(document.querySelector('fieldset:nth-of-type(3) input[value="
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -92,9 +92,9 @@ assert.strictEqual(document.querySelectorAll('fieldset:nth-of-type(4) legend + l
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -84,9 +84,9 @@ assert.exists(document.querySelector('select[id="service"]'));
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -129,9 +129,9 @@ assert.strictEqual(document.querySelector('option[value="excellent"]')?.textCont
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -66,9 +66,9 @@ assert.exists(document.querySelector('option[value="excellent"][selected]'));
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -80,9 +80,9 @@ assert.exists(document.querySelector('label + select[name="food"]'));
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -138,9 +138,9 @@ assert.exists(document.querySelector('fieldset:nth-of-type(4) select#food option
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -66,9 +66,9 @@ assert.strictEqual(document.querySelector('label[for="comments"]')?.textContent.
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -70,9 +70,9 @@ assert.exists(document.querySelector('label + textarea'));
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -78,9 +78,9 @@ assert.exists(document.querySelector('textarea[rows="10"]'));
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -76,9 +76,9 @@ assert.strictEqual(document.querySelector('button')?.textContent.trim(), 'Submit
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -188,9 +188,9 @@ assert.strictEqual(document.querySelector('button')?.textContent.trim(), 'Submit
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>
@@ -66,9 +66,9 @@ assert.exists(document.querySelector("input#reputation[checked]"));
<fieldset>
<legend>Was this your first time at our hotel?</legend>
<input id="yes-option" type="radio" name="hotel-stay" />
<input id="yes-option" type="radio" name="hotel-stay" value="yes" />
<label for="yes-option">Yes</label>
<input id="no-option" type="radio" name="hotel-stay" />
<input id="no-option" type="radio" name="hotel-stay" value="no" />
<label for="no-option">No</label>
</fieldset>