Appendix JS_G_A3
Summary
Requirement: All non-text content has an equivalent text alternative.
Details: Functionality that can’t be presented in text must be descriptively identified.
Examples
Correct code
Refer to the JS_G_A3 live demo for a working example.
<div id="demo"></div>
var container = document.getElementById('demo'); var button = document.createElement('button'); button.setAttribute('type', 'button'); button.appendChild(document.createTextNode('Click me now!')); button.style.visibility = 'hidden'; container.appendChild(button); var delay = Math.floor(10 + (Math.random() * 21)); window.setTimeout(function() { button.addEventListener('click', function() { var diff = new Date().getTime() - appearance; alert('You reacted in ' + (diff / 1000).toFixed(2) + ' seconds'); }, false); var appearance = new Date().getTime(); button.style.visibility = 'visible'; }, (delay * 1000));