On 3/25/24 1:53 AM, Matt Adams wrote:

How can I select (from Tampermonkey script) all SPAN elements in current webpage which contain a property "foobar"?

The assigned value is unimportant.

So elements like the following should be matched:

<span aaa="bbb" foobar="23452345" .....>...</span>

I tried:

$('span[foobar^=""]').remove();

but it didn't work.

And

$('span').attr('foobar').remove();

didn't work either.


You don't need jQuery for this, something like document.querySelectorAll('span[foobar]') will return a live NodeList with all the spans with attribute foobar (regardless of the attribute's value) in it.

Brian

--
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to greasemonkey-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/greasemonkey-users/fa344941-d7a0-4c34-8720-4f7d84bfc9a3%40gmail.com.

Reply via email to