Reputation: 4231
In Firefox, when I open up the Inspector, I can search the HTML using the small box in the top-right corner and entering values like a
to search all links, etc. And I can use [href]
to search all elements with a href
attribute.
But how can I search for all links with a href
attribute that contains test
, for instance? So that it matches <a href="test">Test</a>
, as an example.
I tried [href~=test]
and [href~="test"]
but neither seem to work.
Upvotes: 0
Views: 566
Reputation: 183
Try the below selector. It worked for me when testing in Firefox
a[href*="test"]
Edit I cant read. The "contains word" selector (~=
) must be used when there are words separated by whitespace. Since there is only one word, it wont work. The "contains" selector (*=
) is what you're looking for. The original answer has also been updated
Upvotes: 1
Reputation: 1634
Use *=
instead of ~=
:
[title~="flower"]
Selects all elements with a title attribute containing the word "flower"
a[href*="w3schools"]
Selects every element whose href attribute value contains the substring "w3schools"
Upvotes: 0