How do I do the below with javascript?
$("div.details.counter span")
I can use ID's but I'm curious how we can do the above jQuery style of getting stuff with pure javascript.
The solution with pure javascript for most selectors supported by jQuery is to use document.querySelectorAll:
document.querySelectorAll("div.details.counter span")
If you don't have support for querySelectorAll in your browser of choice, you could take a look at jQuery's implementation of the selector engine to see how it matches various parts of the selector.
Document.querySelectorAll()spantags inside all thedivtags that have a class of bothdetailsandcounterspanelements which have adivancestor with bothdetailsandcounterclass. To avoid confusion regarding the child selector.