I am trying to create a "task list" where a user can post a number via a text box that is displayed below the textbox in a list with checkboxes. When the user ticks the checkboxes and hits delete it should delete the checked tasks. This is working fine but I cannot figure out how to retain the data on the page between sessions. I want anyone to be able to post a task and anyone at any future point to be able to pull up the page, see the tasks already posted, and add tasks or delete ones already there. I am not sure what the best way to retain the data between sessions might be. Thanks in advance for your help.
Here is the HTML portion:
<h2 align="center"><u>Enter New Tasks Below</u></h2>
<h3 align="center">
Type your new task into the text box below and click "Add".<br/><br/>
Once a task or multiple tasks have been completed, check the box next to the task/tasks you would like to remove and click the "Delete Selected Items" button.</h3>
<div class="unconFN" style="margin-right:475px; width:450px; border:2px;">
<table id="tasksFN" cellpadding="3" cellspacing="3" border="0">
<h4>FieldNation UnConfirmed WO Numbers</h4>
<input type="text" id="newFN" />
<br />
<input type="submit" id="addFN" value="Add" />
<br /><br />
</table>
<br />
<input type="button" id="delFN" value="Delete Selected Items" hidden="true" />
</div>
Here is the Javascript/JQuery:
<script>
$(document).ready(function() {
function checkFN(){
//function to hide delete button if table is empty
var x = document.getElementById("tasksFN").rows.length;
if(x == 0){
$("#delFN").hide();
}else{
$("#delFN").show();
}
}
//function to add a new row from the data in the textbox to the table
$("#addFN").click(function() {
var val = $("#newFN").val();
var newTxt = $('<tr><td><input type="checkbox" class="checkbox"></td><td>' + val + '</td></tr>');
$('#myTable').append('<tr><td>' + val + '</td></tr>');
$("#tasksFN").append(newTxt);
$("#newFN").val("");
$("#delFN").show();
});
//function for delete button to remove checked rows
$("#delFN").click(function() {
$(".checkbox:checked").each(function() {
$(this).closest('tr').remove();
});
checkFN();//checks if delete button should be hidden or not
});
});
</script>