Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devilshaircut/cef07f1563ff83aeb9c11288661ca292 to your computer and use it in GitHub Desktop.
Save devilshaircut/cef07f1563ff83aeb9c11288661ca292 to your computer and use it in GitHub Desktop.
var tasks = [ "Drink Coffee", "Eat Donuts", "Go to Gym" ];
var loadTasks = function(myTasks) {
for (var i=0; i < myTasks.length; i++) {
$("#to-do").append("<li>" + myTasks[i] + "</li>");
}
}
var unloadTasks = function() {
$("#to-do").empty();
};
loadTasks(tasks);
var myFunction = function() {
// $("#to-do").append("<li>" + $("#new-to-do").val() + "</li>");
tasks.push($("#new-to-do").val());
unloadTasks();
loadTasks(tasks);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment