Results for “Refs & DOM interaction”
Small, practical examples. Search by task or narrow things down below.
Provide a skip link
Let keyboard users jump directly to focusable main content.
HTML✓ Tested
Remove matching elements
Remove selected list items from the DOM with jQuery.
jQuery✓ Tested
Represent an absent result with optional
C++: value_or supplies a default without requiring a sentinel inside the value domain.
C++✓ Tested
Respect dark color preference
Apply different CSS colors when the browser requests a dark theme.
CSS✓ Tested
Respect reduced motion
Disable a CSS animation when the user prefers reduced motion.
CSS✓ Tested
Reuse colors with custom properties
Define a CSS custom property and use it for text color.
CSS✓ Tested
Select an immediate parent
jQuery: parent moves exactly one level up the DOM.
jQuery✓ Tested
Show a bounded measurement
Display a measured value within a known range using HTML meter.
HTML✓ Tested
Show determinate progress
Represent known completion with an HTML progress element.
HTML✓ Tested
Show keyboard focus
Use a visible CSS outline when an input receives keyboard focus.
CSS✓ Tested
Structure a document with headings
Use a single page heading and a second-level section heading in HTML.
HTML✓ Tested
Toggle a state class
Toggle a CSS class in a jQuery click handler.
jQuery✓ Tested