I have a array of elements I would like to retrieve from a list, I am unable to change the elements, I would usually use jQuery and the call would be:
$("//div/ol/li/h3/a");
However I am unable to sue jquery or another selector framework for that matter, how should this be done.
Note: It seems that
//div/ol/li/h3/ais an XPath expression, which is not supported anymore by jQuery afaik.If your target browsers support it, you can simply use
querySelectorAll[MDN]:Otherwise, a direct conversion would be:
At the end,
setwill contain all links. One could also write a recursive function or simplify the code, if more information about the HTML structure is given.