Last active
July 3, 2019 07:00
-
-
Save temberature/4f986ef049f938a3402784026d9deea7 to your computer and use it in GitHub Desktop.
JS 选择所有包含某个字符的 id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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