-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.js
More file actions
39 lines (34 loc) · 991 Bytes
/
javascript.js
File metadata and controls
39 lines (34 loc) · 991 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
33
34
35
36
37
38
39
$('ul').on("click","li",function(){
// if($(this).css("color")==="rgb(128, 128, 128)")
// $(this).css({
// color:"black",
// textDecoration:"none",
// fontWeight:"normal"
// })
// else
// $(this).css({
// color:"gray",
// textDecoration:"line-through",
// fontWeight:"bold"
// });
$(this).toggleClass("todoCompleted");
//Above one is More Efficient.a
});
$('ul').on("click","span",function(event){
$(this).parent().fadeOut(500,function(){ //for fading out
$(this).remove(); // for removing the element
});//V V Important - Parent
event.stopPropogation();//Imp for stopping event bubbling
});
$("input[type='text']").keypress(function(event){
if(event.which===13)
{
addTodo=$(this).val();
$(this).val("");
$('ul').append("<li><span><i class='fa fa-trash'></i></span> "+addTodo+"</li>");
}
});
$('.fa-pencil-square-o').on("click",function(event){
//alert("hello");
$("input").fadeToggle();
})