Results for “Events & DOM interaction”
Small, practical examples. Search by task or narrow things down below.
Reuse colors with custom properties
Define a CSS custom property and use it for text color.
CSS✓ Tested
Run an event handler once
Use jQuery one for a handler that removes itself after the first event.
jQuery✓ 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
Use a literal value in a regular expression
PowerShell: Regex.Escape prevents a literal dot or other metacharacter from changing the match.
PowerShell✓ Tested
Validate an email input
Use browser constraint validation for a required HTML email field.
HTML✓ Tested