PrivatMamtora
PrivatMamtora

Reputation: 2152

find all elements that used a specific css selector

Trying to do some front end design work and I needed to do some debugging/testing of my css.

I know with most browser dev tools, I can click on an elements and get a full style trace.

But what I want to do is the reverse.

I know the selector and I wish to find all elements that are associated with it (simple ctrl+f not working out)

How would I go about this?

Upvotes: 2

Views: 220

Answers (1)

lonesomeday
lonesomeday

Reputation: 238065

You can surely do this in the normal Javascript console with document.querySelectorAll.

So if you want to find all the elements that match body div.heading h1, do

document.querySelectorAll('body div.heading h1');

The browser console will show the elements it has found. Most also highlight them in the page when you mouseover the listing in the console.

Upvotes: 5

Related Questions