<sectionid="description"> Следующая тема охватывает доступность переключателей. Каждый выбор дается <code>label</code>с<code>for</code> атрибутом привязки к <code>id</code> соответствующего пункта, как рассматривалось в последней задаче. Поскольку радиокнопки часто входят в группу, где пользователь должен выбрать одну, есть способ семантически показать, что выбор является частью набора. Тег<code>fieldset</code> окружает всю группу переключателей для достижения этого. Он часто использует тег <code>legend</code> чтобы предоставить описание для группировки, которое считывается программами чтения с экрана для каждого выбора в элементе <code>fieldset</code>. <code>fieldset</code> и тег <code>legend</code> не нужны, если выбор не требует пояснений, например, гендерный выбор. Использование <code>label</code>с<code>for</code> атрибута для каждого переключателя достаточно. Вот пример: <blockquote><form><br><fieldset><br><legend> Выберите один из этих трех элементов: </ legend><br><input id = "one" type = "radio" name = "items" value = "one"><br><label for = "one"> Выбор 1 </ label><br><br><input id = "two" type = "radio" name = "items" value = "two"><br><label for = "two"> Выбор 2 </ label><br><br><input id = "three" type = "radio" name = "items" value = "three"><br><label for = "three"> Choice Three </ label><br></ fieldset><br></ form><br></blockquote></section>
<sectionid="instructions"> Camper Cat хочет получить информацию о уровне ниндзя своих пользователей, когда они регистрируются в его списке электронной почты. Он добавил набор переключателей и узнал из нашего последнего урока, чтобы использовать метки меток <code>for</code> атрибутов для каждого выбора. Вперед Camper Cat! Однако его код по-прежнему нуждается в некоторой помощи. Измените тег <code>div</code> окружающий радиокнопки, на тег <code>fieldset</code> и измените тег <code>p</code> внутри него на <code>legend</code>. </section>
- text: Ваш код должен иметь тег <code>fieldset</code> вокруг установленного переключателя.
testString: 'assert($("fieldset").length == 1, "Your code should have a <code>fieldset</code> tag around the radio button set.");'
- text: 'Убедитесь, что ваш элемент <code>fieldset</code> имеет закрывающий тег.'
testString: 'assert(code.match(/<\/fieldset>/g) && code.match(/<\/fieldset>/g).length === code.match(/<fieldset>/g).length, "Make sure your <code>fieldset</code> element has a closing tag.");'
- text: 'Ваш код должен иметь тег <code>legend</code> вокруг текста, спрашивающий, какой уровень ниндзя является пользователем.'
testString: 'assert($("legend").length == 1, "Your code should have a <code>legend</code> tag around the text asking what level ninja a user is.");'
<h2>The Garfield Files: Lasagna as Training Fuel?</h2>
<p>The internet is littered with varying opinions on nutritional paradigms, from catnip paleo to hairball cleanses. But let's turn our attention to an often overlooked fitness fuel, and examine the protein-carb-NOM trifecta that is lasagna...</p>
</article>
<imgsrc="samuraiSwords.jpeg"alt="">
<article>
<h2>Defeating your Foe: the Red Dot is Ours!</h2>
<p>Felines the world over have been waging war on the most persistent of foes. This red nemesis combines both cunning stealth and lightening speed. But chin up, fellow fighters, our time for victory may soon be near...</p>
</article>
<imgsrc="samuraiSwords.jpeg"alt="">
<article>
<h2>Is Chuck Norris a Cat Person?</h2>
<p>Chuck Norris is widely regarded as the premier martial artist on the planet, and it's a complete coincidence anyone who disagrees with this fact mysteriously disappears soon after. But the real question is, is he a cat person?...</p>