When I try to manipulate the layout of external sites, I often have to use a chain of selectors to target the specific element that I want. The first time I came across this, I was offered a jQuery solution, and getting the results is very easy. I would rather not rely on jQuery and would like to know as much as possible in standard Javascript. Here is a jQuery 'chain' example -
$('div[id="entry"] > p[class="header"] > span[id="title"] > div[class*="entry"] > p[class="title"] > a[class*="target"]').. etc
Let's say the HTML structure is roughly equal
<div id="entry"> <p class="primary"> <p class="header"> <span class="side"> <span id="title"> <div class="secondary entry"> <p class="return"> <p class="title"> <a class="img"> <a class="mytargetelement">
So how is this possible normal? Thanks.
source share