Skip to content

Instantly share code, notes, and snippets.

@sumitasok
Created May 16, 2012 11:48
Show Gist options
  • Save sumitasok/2709779 to your computer and use it in GitHub Desktop.
Save sumitasok/2709779 to your computer and use it in GitHub Desktop.
Form fields getting Accessible
<form>
<fieldset>
<legend>Form header</legend>
<! this above fieldset legend should have the text explaining the forms purpose >
<label for="id_of_related_input_field">Text corresponding to input field</label>
<input id="id_of_related_input_field" type="..." />
<! have label close to input, have for(label) and id(input) same for identification by screen reader, prefer this way over nesting input under label >
<fieldset>
<legend>Radio button Question Text</legend>
<label for="radio_select_1">
<input id="radio_select_1" type='radio' value='...'>
</fieldset>
<! nest radio buttons, drop boxes and check boxes under fieldset and have legend explaining the inputs question >
</fieldset>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment