Unit 2 · Client-side web applications
HTML communicates structure and meaning; CSS controls presentation; JavaScript adds behavior. Prefer a real button for an action, a label for an input, and headings that describe document hierarchy.
<button id="load" type="button">Load courses</button>
<ul id="courses" aria-live="polite"></ul>
<script type="module">
const button = document.querySelector('#load');
button.addEventListener('click', () => {
document.querySelector('#courses').textContent = 'Loading...';
});
</script>Use event listeners rather than inline handlers. Keep DOM updates small and clear. Progressive enhancement means the basic document remains understandable even if a script fails.
aria-live communicate?1. Which layer describes document meaning?
2. What event should a keyboard user be able to trigger?
A good answer uses headings, lists, links or buttons according to action, visible focus, readable contrast, responsive grid tracks, and a fallback document that still lists course names if JavaScript does not run.