Skip to content

Instantly share code, notes, and snippets.

@RadianSmile
Created April 25, 2017 16:59
Show Gist options
  • Save RadianSmile/14c1f0492d7de0b37b67cfb2353e9128 to your computer and use it in GitHub Desktop.
Save RadianSmile/14c1f0492d7de0b37b67cfb2353e9128 to your computer and use it in GitHub Desktop.
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