Skip to content

Instantly share code, notes, and snippets.

@temberature
Last active July 3, 2019 07:00
Show Gist options
  • Save temberature/4f986ef049f938a3402784026d9deea7 to your computer and use it in GitHub Desktop.
Save temberature/4f986ef049f938a3402784026d9deea7 to your computer and use it in GitHub Desktop.
JS 选择所有包含某个字符的 id
document.querySelectorAll('[id*=block]')
Array.apply(null, document.querySelectorAll('[id]')).map(item => item.getAttribute('id')).filter(item => item.includes('block'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment