Results for “Lists & control flow”
Small, practical examples. Search by task or narrow things down below.
Disable a related group of controls
HTML: A disabled fieldset prevents editing its descendant controls and omits them from form submission.
HTML✓ Tested
Divide decimal values with controlled precision
Java: Choose both scale and rounding for a quotient that does not terminate in base ten.
Java✓ Tested
Flatten one level of nested lists
Python: Use a nested comprehension when each input item is itself an iterable.
Python✓ Tested
Group related controls with a fieldset and legend
Group related controls with a fieldset and legend with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Group related form controls semantically
Group related form controls semantically with a small React component and explicit browser behavior.
React✓ Tested
Group related typed controls
Group related typed controls with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Handle integer overflow without panicking
Handle integer overflow without panicking in a complete Rust program using the standard library.
Rust✓ Tested
Hide interface controls in print layout
CSS: A print media query can retain article content while removing interactive controls.
CSS✓ Tested
Keep a control fixed to the viewport during scrolling
CSS: Fixed positioning normally uses the viewport when no ancestor establishes a different fixed containing block.
CSS✓ Tested
Read an uncontrolled field through a ref
Read an uncontrolled field through a ref with a small React component and explicit browser behavior.
React✓ Tested
Read an uncontrolled form with FormData
Read an uncontrolled form with FormData with a small React component and explicit browser behavior.
React✓ Tested
Represent a hierarchy with nested lists
HTML: Place the nested list inside its parent list item to preserve the hierarchy.
HTML✓ Tested