6

For example, I need to have a list of all tags that have id attribute set (it could be any other attribute, id is just an example).

4

1 回答 1

11

Try this:

document.querySelectorAll('[id]')
于 2012-01-01T17:40:25.773 回答