Appendix JS_G_A5


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.


Correct code

Refer to the JS_G_A5 live demo for a working example.

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