I’ve only just begun to have exposure to JQuery/Javascript as a primary language. I’ve been progressively going through tutorials and other sites such as JQuery’s own and w3schools.

From what I’ve found, JS quite enjoyable and JQuery even more so as it reduces the code I need to write to get things done (at the expense of the initial learning).

I’ve got a long way to go but here is a minimalistic list I’ve made for myself of various Selectors and filtering on those selectors.


$allListItems = $("li");
$alldivs = $("div");
$whodom = $("*");
$byclass = $(".someclass");
$byId = $("#Id");

Descendant Selector

$all_li_in_fancylist = $("li" .fancylist");

– Descendant of class/id etc constraint
= All items that are a descendants of list items that have a class of fancylist

Child Selector

$(".shiny > a")

-Ancestor > child type
= All links that are a child of an element with a class of shiny



= Will select all list-elements that are the first child of their parent.

Filtering Selections

$alldivs = $("div");
$lastdiv = $alldivs.last();
$2nddiv = $alldivs.eq(1);
Learning JQuery – Selectors