Appendix JS_G_A5

Summary

Requirement: Labels or instructions are provided when content requires user input.

Details: Interactive content must have an associated label or short instructions about its behaviour.

Examples

Correct code

Refer to the JS_G_A5 live demo for a working example.

<form action="#">
    <fieldset>
        <div>
            <label for="demo">Please choose a color:</label>
            <button id="demo" type="button"><span>+</span></button>
        </div>
    </fieldset>
</form>
document.getElementById('demo').addEventListener('click', function()
{
    alert('The button\'s click event fired');
 
}, false);