Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Interactive Web Pages with JavaScript Traversing and Manipulating the DOM with JavaScript Perform: Traversing Elements with querySelector

Konrad Pilch
Konrad Pilch
2,435 Points

Code to downolad


Can somebody give me all the code from here to downolad? i cant downolad the file as it wont open.. and i cant see what hes typing as the quality is too bad.

I just need the full JS file.

// new entry add
var taskInput = document.getElementById("new-task");
// button for new entry
var addButton = document.getElementsByTagName("button")[0];
// ul li list of incompleted task
var incompledTaskHolder = document.getElementById("incomplete-tasks");
// ul li list of completed task
var completedTaskHolder = document.getElementById("completed-tasks");

var addTask = function () {
    console.log('add task');
var editTask = function () {
    console.log('edit task');
var deleteTask = function () {
    console.log('delete task');
var taskCompleted = function () {
    console.log('task complete');
var taskIncomplite = function () {
    console.log('task incomplete');

// binding children, edit, delete and completed or incomplete event (checkBoxEventHandler)
var bindTaskEvents = function (taskListItem, checkBoxEventHandler){
    console.log('bind list item');
    // for each list item
    // select children of li
    var checkBox = taskListItem.querySelector('input[type=checkbox]');
    var editButton = taskListItem.querySelector('button.edit');
    var deleteButton = taskListItem.querySelector('button.delete');

    // bind edit task to edit
    editButton.onclick = editTask;
    // bind deletetask to delete
    deleteButton.onclick = deleteTask;
    // bin taskcomplete to checkbox depednce wgat we catcg complete or incomplete
    checkBox.onchange = checkBoxEventHandler;

// for each incompleted ul li start function bindEvents
for(var i=0; i < incompledTaskHolder.children.length; i++){

    bindTaskEvents(incompledTaskHolder.children[i], taskIncomplite);

// for each completed ul li start function bindEvents
for(var i=0; i < completedTaskHolder.children.length; i++){

    bindTaskEvents(completedTaskHolder.children[i], taskCompleted);
addButton.onclick = addTask;