Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/2-browser-apps/06-project/_samples/todo/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ const todoList = document.getElementById("todo-list");
const todoInput = document.getElementById("todo-input");
const addButton = document.getElementById("add-button");

todoInput.oninput = () => (addButton.disabled = todoInput === "");
todoInput.oninput = () => {
addButton.disabled = todoInput.value === "";
};
Comment on lines +5 to +7
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MDXファイルの内容に合わせた形です。


addButton.onclick = () => {
const todoItem = document.createElement("li");
Expand Down
2 changes: 1 addition & 1 deletion docs/2-browser-apps/06-project/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ addButton.onclick = () => {
addButton.disabled = true; // valueへの代入はoninputイベントを発火しない
editButton.textContent = "編集";
editButton.onclick = () => {
const input = prompt("新しい内容を入力してください"。);
const input = prompt("新しい内容を入力してください。");
// prompt関数は入力された文字列が空の場合は空文字列 ("")、キャンセルされた場合はnullを返す
if (input !== "" && input !== null) todoText.textContent = input;
};
Expand Down
Loading