Day 023 - Next and Previous


Here you'll learn how it's possible to use .next and .prev to select elements.

Take the following example:

$('ul li:first-child').next().css('color', 'crimson');

Here you look for the first li element then using the .next method, select the next element.

Similarly, it's possible to use .prev to select the previous element.

Take a look at this demo and inspect the elements for a closer look.