Reputation: 481
Using vanilla JavaScript, you can write
const box = document.querySelector(".box");
const button = box.querySelector(".button");
How about Cheerio? I want to do something like:
const box = $(".box");
const button = box.$(".button")
I'm asking because I have to loop over elements then find an anchor tag within that element:
const $ = cheerio.load(stdout)
const boxes = $(".box").map((i, element) => element)
boxes.each((i, element) => ?? maybe element.querySelector("a") )
Upvotes: 3
Views: 870