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
- just-one-small-sip
- close together
- css 오버레이
- Prototype
- express-handlebars
- css variables
- css
- Node.js
- Express
- 무료 백엔드 배포
- Engoo
- shit-christmas
- select by attribute
- css grid
- 정규표현식
- improve-iq-by-up-to-10%!
- img 확대
- es6
- regExp
- Sass
- Object.create
- flexbox
- node
- flex-shrink
- flex-basis
- flex-grow
- JS
- ajax
- module wrapper function
- 디자인패턴
Archives
- Today
- Total
Creating Elements 본문
// Create element
const li = document.createElement("li");
// Add class
li.className = "collection-item";
// Add id
li.id = "new-item";
// Add attribute
li.setAttribute("title", "New Item");
// Create text node and append
li.appendChild(document.createTextNode("Hello World"));
// Create new link element
const link = document.createElement("a");
// Add classes
link.className = "delete-item secondary-content";
// Add HTML Icon
link.innerHTML = `<i class="fa fa-remove"></i>`;
// Append link into li
li.appendChild(link);
// Append li as child to ul
document.querySelector("ul.collection").appendChild(li);
console.log(li);
'2021 프론트 엔드 로드맵 따라가기 > JS' 카테고리의 다른 글
Mouse events (0) | 2021.05.31 |
---|---|
Replace & Remove Elements (0) | 2021.05.31 |
traversing dom (0) | 2021.05.30 |
Multiple Selector (0) | 2021.05.30 |
single selector (0) | 2021.05.30 |
Comments