Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.