Calculator Tools Calculator Tools
Create

Task Tracker

Oct 25, 2023

About this app

A tool to keep track of completed tasks

Task Tracker

Related apps

Put this on your site

Source

                    <html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">

<title>Task Tracker</title>
<meta name="description" content="A tool to keep track of completed tasks">
<meta name="keywords" content="task tracker, completed tasks, productivity">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">

<script type="text/javascript">
try {
// App Javascript Goes Here. Place your entire script content inside the try block for error handling.

// This will run when the DOM is ready.
document.addEventListener("DOMContentLoaded", function() {
// Get the task list from the user
const taskList = [
"Task 1",
"Task 2",
"Task 3",
"Task 4",
"Task 5"
];

// Create HTML for the task tracker
let html = '<h1>Task Tracker</h1>';
html += '<p>Select the tasks you have completed:</p>';
html += '<ul>';
taskList.forEach(function(task) {
html += '<li><input type="checkbox" id="' + task + '">' +
'<label for="' + task + '">' + task + '</label></li>';
});
html += '</ul>';
html += '<button id="submitBtn" class="btn btn-primary">Submit</button>';
html += '<div id="result"></div>';

// Add the HTML to the main container
$('#main-container').html(html);

// Add event listener to the submit button
$('#submitBtn').click(function() {
let completedTasks = [];

// Check which tasks are completed
taskList.forEach(function(task) {
if ($('#' + task).is(':checked')) {
completedTasks.push(task);
}
});

// Display the number of completed tasks
$('#result').html('<p>You completed ' + completedTasks.length +
' out of ' + taskList.length + ' tasks.</p>');
});
});

} catch (error) {
// This will throw the error to the parent window.
throw error;
}
</script>

<style>
body {
font-family: 'Roboto', sans-serif;
background-color: #f9f9f9;
}

#main-container {
max-width: 600px;
margin: 0 auto;
padding: 40px;
text-align: center;
}

h1 {
font-size: 32px;
margin-bottom: 20px;
}

p {
font-size: 18px;
margin-bottom: 20px;
}

ul {
list-style-type: none;
padding: 0;
margin-bottom: 20px;
}

li {
margin-bottom: 10px;
}

label {
margin-left: 10px;
}

button {
font-size: 18px;
}

#result {
font-size: 18px;
margin-top: 20px;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<!-- App HTML Goes Here -->
</div>
</body>
</html>