Developer Checklist — JavaScript Appendices

Correct code

JS_G_A6: Use functions of the DOM to add content to a page

This example shows how to use standard DOM functions to add content to a page via JavaScript, as opposed to using the deprecated document.write function, or proprietary properties like innerHTML or innerText.

The use of these non-standard functions and properties is considered an accessibility failure, because content added this way is subject to browser-specific differences in interpretation and normalization, and therefore variations in the ability of access technologies to programatically access it.

Live Demo

JavaScript Code

The JavaScript code for this example can be found in: JS_G_A6.js