document.getElementById(‘myElement‘);
document.querySelector(‘#myElement‘);
document.getElementsByClassName(‘myElement‘);
document.querySelectorAll(‘.myElement‘);
document.getElementsByTagName(‘div‘);
document.querySelectorAll(‘div‘);
document.querySelectorAll(‘[data-foo-bar="someval"]‘)
document.querySelectorAll(‘#myForm :invalid‘);
document.getElementById(‘myParent‘).children;
document.querySelector(‘#myParent > [ng-click]‘);
document.querySelectorAll(‘#myParent A‘);
document.querySelectorAll(‘DIV:not(.ignore)‘);
document.querySelectorAll(‘DIV, A, SCRIPT‘);
CSS3:
p:not(.first) {
color: red;
}
p:not(.first):not(.fourth) {
color: red;
}
元素重1开始,没有0;
p:not(:nth-child(2)):not(:first-child) {
color: red;
}
时间: 2024-10-14 15:23:21