-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
27 lines (24 loc) · 1.09 KB
/
script.js
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
$(document).ready(function () {
var count = 0;
$('#btn').on("click", function () {
var inputValue = $('.input-value').val();
if (inputValue != '') {
count++;
$(".to-do").append('<li class="accord"><input type="checkbox" class = "check" id="check-' + count + '"><label for="check-' + count + '"></label><span class="main-content">' + inputValue + '</span><span class="remove"><i class="material-icons">delete_forever</i></span></li>')
}
$('.input-value').val('');
$(document).on('change', 'input[type="checkbox"]', function () {
if ($(this).is(':checked')) {
$(this).closest("li").children(".remove").addClass("active");
} else {
$(this).closest("li").children(".remove").removeClass("active");
}
})
$(document).on('click', '.remove', function () {
$(this).parent().fadeOut(500);
})
$('ul').on('click', '.check', function () {
$(this).parent('li').toggleClass('checkin');
})
})
})