Created
April 25, 2017 16:59
-
-
Save RadianSmile/14c1f0492d7de0b37b67cfb2353e9128 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var todoUndoneClass = "list-group-item" , | |
todoDoneClass = "list-group-item list-group-item-success" | |
// 把事件註冊在 todo 的母階層 | |
document.getElementById("todo-todoList").addEventListener(function(e){ | |
// 母階層裡面的物件 | |
if(e.target.className === todoDoneClass){ | |
e.target.className = todoUndoneClass | |
}else { | |
e.target.className = todoDoneClass | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment