Selecting a sibling element

Hey there,

I am wondering if there is a way to select an element that comes right after another element. Not a child but a sibling. The data is dynamic and the first element holds the class that reveals if the data is an email address or phone number.
sibling

so for my field "phone" it would be .fa-phone a if it was a parent/child, but it is not...

Any ideas?
THX
Gabriel

Oh boy - sorry for being stupid. The CSS selector of course is just
.fa-phone + a

:slight_smile:

Yes the + will work. You can also select <a> tag based on its href text e.g.

a[href^='tel']

1 Like

Thanks a lot! Can you tell me what kind of language that is, so I can research other expressions? I have worked with xpath a little but a[href^='tel'] seems to something else.

Gabriel

Those are just CSS selectors, like the + you used. More info here:
https://www.w3schools.com/cssref/css_selectors.asp

WS also supports some jQuery selectors.
https://api.jquery.com/category/selectors/