title: knockoutjs click binding within foreach binding
body: <p><strong>EDIT: Problem was not related to the binding but to a simple JavaScript mistake.</strong></p>
  
  <p>I have a question concerning a click binding within a foreach binding.
  I have a list with items showing a drop down box to select a value from the master data. Items can be added and removed from that list. 
  The button to remove items is nested in the foreach binding. Therefore I expected that I should bind it with $parent></p>
  
  <pre><code>&lt;button data-bind="click: $parent.removeNumber"&gt;-&lt;/button&gt;
  </code></pre>
  
  <p>That does not work. But the following version works:</p>
  
  <pre><code>&lt;button data-bind="click: removeNumber"&gt;-&lt;/button&gt;
  </code></pre>
  
  <p>I do not understand why.</p>
  
  <p>The code:</p>
  
  <pre><code>&lt;h2&gt;numbers:&lt;/h2&gt;
   &lt;ul data-bind="foreach: numbers"&gt;
       &lt;li&gt;
         &lt;select data-bind="value: id, 
                            options: masterData, 
                            optionsText: 'caption', 
                            optionsValue: 'id'"&gt;&lt;/select&gt;
          &lt;br /&gt;
          value: &lt;span data-bind="text: id"&gt;&lt;/span&gt;
          &lt;br /&gt;
          &lt;button data-bind="click: $parent.removeNumber"&gt;-&lt;/button&gt;      
      &lt;/li&gt;
  &lt;/ul&gt;
  &lt;button data-bind="click: addNumber"&gt;+&lt;/button&gt;
  </code></pre>
  
  <p>​</p>
  
  <pre><code>function ViewModel() {
      self.masterData = [{ id: 1, caption: "One"},
                         { id: 2, caption: "Two"}];
  
     self.numbers = ko.observableArray([{
          id: ko.observable(2)}]);
  
      self.addNumber = function() {
          self.numbers.push({
              id: ko.observable(2)
          });
      };
  
  
      self.removeNumber = function(item) {
          self.numbers.destroy(item);
          console.log("removed" + item);
      };
  }
  
  var viewModel = new ViewModel();
  ko.applyBindings(viewModel);​
  </code></pre>
  
  <p>I have created a fiddle (with the not working version):
  <a href="http://jsfiddle.net/delixfe/NWWH8/" rel="noreferrer">http://jsfiddle.net/delixfe/NWWH8/</a></p>
  
  <p>Thanks for your help.</p>