-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtodo.js
More file actions
32 lines (29 loc) · 935 Bytes
/
Copy pathtodo.js
File metadata and controls
32 lines (29 loc) · 935 Bytes
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
29
30
31
32
/* TO DO LIST */
$(".tdl-new").bind('keypress', function(e){
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) {
var v = $(this).val();
var s = v.replace(/ +?/g, '');
if (s == ""){
return false;
}else{
$(".tdl-content ul").append("<li><label><input type='checkbox'><i></i><span>"+ v +"</span><a href='#'>–</a></label></li>");
$(this).val("");
}
}
});
$(".tdl-content a").bind("click", function(){
var _li = $(this).parent().parent("li");
_li.addClass("remove").stop().delay(100).slideUp("fast", function(){
_li.remove();
});
return false;
});
// for dynamically created a tags
$(".tdl-content").on('click', "a", function(){
var _li = $(this).parent().parent("li");
_li.addClass("remove").stop().delay(100).slideUp("fast", function(){
_li.remove();
});
return false;
});