File tree Expand file tree Collapse file tree 4 files changed +10
-15
lines changed
docs/2-browser-apps/06-project/_samples Expand file tree Collapse file tree 4 files changed +10
-15
lines changed Original file line number Diff line number Diff line change 1- const addButton = document . getElementById ( "add-button" ) ;
21const todoList = document . getElementById ( "todo-list" ) ;
32const todoInput = document . getElementById ( "todo-input" ) ;
3+ const addButton = document . getElementById ( "add-button" ) ;
44
55addButton . onclick = ( ) => {
6- const inputValue = todoInput . value ;
7- todoInput . value = "" ;
86 const todoItem = document . createElement ( "li" ) ;
97 const todoText = document . createElement ( "span" ) ;
10- todoText . textContent = inputValue ;
8+ todoText . textContent = todoInput . value ;
9+ todoInput . value = "" ;
1110 todoItem . appendChild ( todoText ) ;
1211 todoList . appendChild ( todoItem ) ;
1312} ;
Original file line number Diff line number Diff line change 1- const addButton = document . getElementById ( "add-button" ) ;
21const todoList = document . getElementById ( "todo-list" ) ;
32const todoInput = document . getElementById ( "todo-input" ) ;
3+ const addButton = document . getElementById ( "add-button" ) ;
44
55addButton . onclick = ( ) => {
6- const inputValue = todoInput . value ;
7- todoInput . value = "" ;
86 const todoItem = document . createElement ( "li" ) ;
97 const todoText = document . createElement ( "span" ) ;
108 const deleteButton = document . createElement ( "button" ) ;
11- todoText . textContent = inputValue ;
9+ todoText . textContent = todoInput . value ;
10+ todoInput . value = "" ;
1211 deleteButton . textContent = "削除" ;
1312 deleteButton . onclick = ( ) => {
1413 todoList . removeChild ( todoItem ) ;
Original file line number Diff line number Diff line change @@ -3,13 +3,12 @@ const todoInput = document.getElementById("todo-input");
33const addButton = document . getElementById ( "add-button" ) ;
44
55addButton . onclick = ( ) => {
6- const inputValue = todoInput . value ;
7- todoInput . value = "" ;
86 const todoItem = document . createElement ( "li" ) ;
97 const todoText = document . createElement ( "span" ) ;
108 const editButton = document . createElement ( "button" ) ;
119 const deleteButton = document . createElement ( "button" ) ;
12- todoText . textContent = inputValue ;
10+ todoText . textContent = todoInput . value ;
11+ todoInput . value = "" ;
1312 editButton . textContent = "編集" ;
1413 editButton . onclick = ( ) => {
1514 const input = document . createElement ( "input" ) ;
Original file line number Diff line number Diff line change 11const todoList = document . getElementById ( "todo-list" ) ;
22const todoInput = document . getElementById ( "todo-input" ) ;
33const addButton = document . getElementById ( "add-button" ) ;
4-
54todoInput . oninput = ( ) => {
65 addButton . disabled = todoInput . value === "" ;
76} ;
87
98addButton . onclick = ( ) => {
10- const inputValue = todoInput . value ;
11- todoInput . value = "" ;
129 addButton . disabled = true ;
1310 const todoItem = document . createElement ( "li" ) ;
1411 const todoText = document . createElement ( "span" ) ;
1512 const editButton = document . createElement ( "button" ) ;
1613 const deleteButton = document . createElement ( "button" ) ;
17- todoText . textContent = inputValue ;
14+ todoText . textContent = todoInput . value ;
15+ todoInput . value = "" ;
1816 editButton . textContent = "編集" ;
1917 editButton . onclick = ( ) => {
2018 const input = document . createElement ( "input" ) ;
You can’t perform that action at this time.
0 commit comments