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 children

what does the word "bind" mean in this context?

I'm lost as to why we need to "bind" editTask, deleteTask, etc.

2 Answers

Sherly Chan
Sherly Chan
7,250 Points

The event binding allows you to add an event handler for a specified event so that your chosen JavaScript function will be invoked when that event is triggered for the associated DOM element. http://knockoutjs.com/documentation/event-binding.html

Bruno Dias
Bruno Dias
10,554 Points

Thank you for clarifying that. Your explanation was better than the instructor (he didn't explain the bind event at all).

Lucia Hsieh
Lucia Hsieh
5,380 Points

Hello Johnny,

I am relatively new to JavaScript but I think this is what it means: I believe that the word "bind" means that you are grouping different actions together to act as one event. So in this context, editTask selects the edit button and allows the user to edit it if "edit-mode" is on, and if "edit-mode" is not on, then the user can't edit.

If a "bind" was not in place, then there is no actions that perform together.

I hope this makes sense.