Posts

Showing posts with the label jquery-selectors

JQuery selector to ignore an element?

JQuery selector to ignore an element? I am extracting article page content. One selector, "entry": $('div.content__article-body').html().trim() gets the main article body. This mostly comprises text paragraphs with their <p> and header tags, which is just what I want. However, it also gets an element I don't want, which is <aside> . How can I ensure <aside> is NOT included in the resulting text? "entry": $('div.content__article-body').html().trim() <p> <aside> <aside> I have read threads on here about "not". I have tried things like ... $('div.content__article-body').not('aside').html().trim() $('div.content__article-body').html().not('aside').trim() $('div.content__article-body:not(aside)').html().trim() or $('div.content__article-body:not('aside')').html().trim() - not sure. $('div.content__article-body:not(aside)').html().trim() $...