Skip to content

Instantly share code, notes, and snippets.

@AlexandroPerez
Last active March 3, 2017 02:37
Show Gist options
  • Save AlexandroPerez/0294c56ad21e98fc6541cb33f9e1c0ed to your computer and use it in GitHub Desktop.
Save AlexandroPerez/0294c56ad21e98fc6541cb33f9e1c0ed to your computer and use it in GitHub Desktop.
How jQuery END works
$('#lists')
.find(' > li') // FILTER1 #lists > li
.filter('li:last') // FILTER1_1 #lists > li:last
.addClass('coloring2')
.end() // go back to previous filter: FILTER1 #lists > li
.find('ul') // FILTER1_2: find ul inside #lists > li
.filter('> li') // FILTER1_2_1: ul > li inside #lists > li
.addClass('coloring')
.end() // go back one filter FILTER1_2
.end() // go back one filter FILTER1
.end() // go back one filter NO FILTER
.find('li') // FILTER2 #lists > li
.appendTo('body');
//===================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment