I'm looking for a way to access the <li>
elements present with pseudo-elements such as ::before
and ::marker
using Javascript. So far I'm not able to write a unique selector for those <li>
elements which can highlight only those which are present with ::before
or ::marker
. Any ideas would be great.
document.querySelectorAll('div.simple-description"] li').forEach((li) => {
if ((li.querySelector('li'), 'marker') === "marker") {
li.setAttribute('bullet', "true")
}
})
<div class="simple-description">
<p>Sample data Sample data Sample data Sample data</p>
<li>Without marker</li>
<li>::marker DATA with ::marker</li>
<li>::marker Want to access this</li>
<li>::before Data with ::before</li>
</div>
Sample URL to try this on: https://www.windeln.de/aussie-spuelung-repair-miracle.html