Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// Tab switcher: deactivate siblings, activate clicked $('.tab').on('click', function () { $(this).addClass('active') .siblings().removeClass('active'); }); // Step wizard: highlight completed steps above current $('#current-step').prevAll('.step').addClass('completed'); // Insert an element between two siblings $('#item-3').after('<li id="item-3b">Item 3b</li>'); // Collect all items until a divider var $group = $('#item-start').nextUntil('.divider'); console.log('Items in group:', $group.length); // Alternate row colouring $('tr:first').nextAll().filter(':even').addClass('stripe');
Result
Open