Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- img 확대
- module wrapper function
- flex-grow
- JS
- select by attribute
- Object.create
- es6
- flexbox
- ajax
- regExp
- Node.js
- css variables
- shit-christmas
- express-handlebars
- node
- just-one-small-sip
- Sass
- flex-basis
- flex-shrink
- 디자인패턴
- Express
- css
- improve-iq-by-up-to-10%!
- Prototype
- css grid
- 무료 백엔드 배포
- 정규표현식
- Engoo
- close together
- css 오버레이
Archives
- Today
- Total
single selector 본문
// // document.getElementById()
// console.log(document.getElementById("task-title"));
// // Get things from the element
// console.log(document.getElementById("task-title").id);
// console.log(document.getElementById("task-title").className);
// const taskTitle = document.getElementById("task-title");
// // Change styling
// taskTitle.style.background = "#333";
// taskTitle.style.color = "#fff";
// taskTitle.style.padding = "5px";
// // document.getElementById("task-title").style.display = "none";
// // Change content
// taskTitle.textContent = "Task List";
// taskTitle.innerText = "My Tasks";
// taskTitle.innerHTML = `<span style="color:red">Task List</span>`;
// document.querySelector()
console.log(document.querySelector("#task-title"));
console.log(document.querySelector(".card-title"));
console.log(document.querySelector("h5"));
document.querySelector("li").style.color="red";
document.querySelector("ul li").style.color="blue";
document.querySelector("li:last-child").style.color="red"; // can use pesudo class
document.querySelector("li:nth-child(3)").style.color="yellow";
document.querySelector("li:nth-child(4)").textContent="Hello World";
document.querySelector("li:nth-child(odd)").style.background = "#ccc"; // selected only one odd child;
document.querySelector("li:nth-child(even)").style.background = "#ccc"; // selected only one even child;
'2021 프론트 엔드 로드맵 따라가기 > JS' 카테고리의 다른 글
traversing dom (0) | 2021.05.30 |
---|---|
Multiple Selector (0) | 2021.05.30 |
Document Object (0) | 2021.05.30 |
Variable Scope (0) | 2021.05.30 |
Math Object (0) | 2021.05.29 |
Comments