Results for “while”
Small, practical examples. Search by task or narrow things down below.
Replace an element while preserving its position
jQuery: replaceWith swaps an entire node.
jQuery✓ Tested
Respond while a user types
jQuery: Learn how to respond while a user types in a complete browser example.
jQuery✓ Tested
Reverse a copy while preserving the original
JavaScript: Copy before reverse because reverse mutates the array it receives.
JavaScript✓ Tested
Reverse a copy while preserving the original
TypeScript: Copy before reverse because reverse mutates the array it receives.
TypeScript✓ Tested
Reverse a copy while preserving the source
PowerShell: Clone the array before using Array.Reverse because Reverse mutates its argument.
PowerShell✓ Tested
Save a stream while displaying it
Linux Commands: Use tee to write a copy of standard input to a file.
Linux Commands✓ Tested
Select siblings while excluding the current element
jQuery: siblings selects other children of the same parent.
jQuery✓ Tested
Split a record while retaining its remainder
Bash Scripts: The final read variable receives the remainder of a delimited record.
Bash Scripts✓ Tested
Start a disclosure open while keeping it collapsible
HTML: The open attribute sets the initial details state without JavaScript.
HTML✓ Tested
Stash unstaged work while leaving staged edits available
Git: Keep-index preserves the staged state for testing or committing while stashing the rest.
Git✓ Tested
Stop tracking a generated file while keeping it locally
Git: Removing a path from the index leaves its working copy intact when cached is specified.
Git✓ Tested
Submit a readonly value while preventing edits
HTML: Readonly controls remain in form data, unlike disabled controls.
HTML✓ Tested