取代选择器$()的方式

1
2
3
4
5
6
7
8
9
10
11
12
13
function $(elem) {
let list = document.querySelectorAll(elem);

return list;
}

let a = $(".odiv")[0];

a.style.width = "100px";

a.style.height = "100px";

a.style.background = "#000";