Results for “control”
Small, practical examples. Search by task or narrow things down below.
Prevent navigation from a handled link
jQuery: preventDefault cancels the browser action without cancelling event bubbling.
jQuery✓ Tested
Provide a fallback for a nullable value
C#: The null-coalescing operator supplies a default only when the left side is null.
C#✓ Tested
Read a handler result without event bubbling
jQuery: triggerHandler invokes the first matched element’s handlers without native default behavior.
jQuery✓ Tested
Read a selection when its change event fires
jQuery: A change handler observes the current selected value.
jQuery✓ Tested
Remove a list item by identifier
Remove a list item by identifier with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Remove one handler without removing others
jQuery: Pass the original function reference to off.
jQuery✓ Tested
Remove related events by namespace
jQuery: Namespaced events let a feature clean up its own handlers.
jQuery✓ Tested
Render groups with nested loops
Render groups with nested loops with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Represent a finite set of states
Java: Use an enum to prevent arbitrary strings from representing application states.
Java✓ Tested
Respond to the Enter key
jQuery: Use the event key rather than deprecated numeric key codes.
jQuery✓ Tested
Return a value from a switch expression
Java: Use an exhaustive switch expression with a fallback for other input values.
Java✓ Tested
Return multiple named values from a method
C#: Named value tuples give lightweight field names without a separate class.
C#✓ Tested