Category: jQuery

jQuery / Selector / :even - Select Even-Indexed Elements
Learn zero-based :even indexing and migrate to the recommended .even() method. A runnable two-list example compares combined selection, per-list selection and :nth-child(even), including expected results and reset controls.

jQuery / Selector / :empty - Select Elements with No Content
Understand how :empty treats whitespace, comments and child elements. A complete table example fills empty cells with N/A, resets them, and explains re-querying, .empty() and input-value checks.

jQuery .prependTo(): Insert Content as the First Child
Use jQuery .prependTo() to move a notice to the first-child position or keep the original and insert copies at the start of several containers.

jQuery .insertAfter(): Insert Content as the Next Sibling
Put an error message immediately after a form field with jQuery .insertAfter(), then compare sibling placement, insertion inside a target, and return values.

jQuery .insertBefore(): Insert Content as the Previous Sibling
Move an existing notice immediately before a target with jQuery .insertBefore() and verify sibling placement and that its button still works.

jQuery .slideToggle(): Toggle a Collapsible Panel
Toggle a hidden or visible panel with jQuery .slideToggle(), handle rapid clicks and reset, and wait for several panels to finish.

jQuery .slideDown(): Expand and Show Hidden Content
Reveal a hidden panel with jQuery .slideDown(), wait for the effects queue, and diagnose an ancestor or CSS rule that keeps the panel hidden.

jQuery .slideUp(): Collapse and Hide Content
Collapse an element with jQuery .slideUp(), distinguish per-element and queue completion, and test a panel with keyboard focus and rapid inputs.

jQuery .val(): Read and Set Form Field Values
Read and set current field values and multiple selections, and handle change events separately from value assignment.

jQuery .each(): Iterate over Elements and Stop a Loop
Use callback indices and element references, stop a loop correctly, and avoid confusing element iteration with asynchronous sequencing.