title: Knockout: Unable to process binding
body: <p>I asked this question earlier but did not get an answer.</p>
  
  <p>I get this error message when I run my code: </p>
  
  <pre><code>Uncaught ReferenceError: Unable to process binding "visible: function (){return !editable() }"
  Message: editable is not defined 
  </code></pre>
  
  <p>the editable function is supposed to toggle true/false and then switch to edit mode when a button is pressed. This button is called through a foreach in the html so i'm guessing it has something to do with my viewmodel. The output I get from my getJson works fine but the editable function conflicts somehow.</p>
  
  <p>Here is my html code: </p>
  
  <pre><code>&lt;div&gt;&lt;ul data-bind="foreach: comments"&gt;
    &lt;li class="ul3"&gt;
       &lt;span class="author" data-bind="text: nickname, visible: !editable(), click: editComment"&gt;
      &lt;/span&gt;
       &lt;input type="text" data-bind="value: nickname, visible: editable()"/&gt;:
       &lt;div&gt;  
  
       &lt;span class="comment" data-bind="text: newMsg, visible: !editable(), click: editComment"&gt;    
       &lt;/span&gt;
       &lt;textarea class="myComment" type="text" data-bind="value: newMsg, visible: editable()"&gt;                       
      &lt;/textarea&gt;
  
      &lt;/div&gt;
       &lt;button data-bind="click: editComment, text: editable() ? 'Save' : 'Edit comment'"&gt;           
       &lt;/button&gt; 
       &lt;button data-bind="click: deleteComment"&gt;Delete&lt;/button&gt;
            &lt;/li&gt;
         &lt;/ul&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>And here is my javascript:</p>
  
  <pre><code>      function Comment() {
      var self = this;
      self.nickname = ko.observable();
      self.newMsg = ko.observable();
      self.editable = ko.observable(false);
  
      self.sendEntry = function () {
       vm.selectedComment(new Comment());
  
          if (self.newMsg() !== "" &amp;&amp; self.nickname() !== "") {
  
              $.post(writeUrl, "entry=" + ko.toJSON(self));
              self.newMsg("");
          }
          vm.cSection().getNewEntries();
      };
      self.deleteComment = function () {
          vm.comments.remove(self);
      };
  
       self.editComment = function () {
          self.editable(!self.editable());
      };
  }
  function commentSection() {
      var self = this;
      self.timestamp = 0;
       var entry;
      self.getNewEntries = function () {
  
          $.getJSON(readUrl, "timestamp=" + self.timestamp, function (comments) {
              for (var i = 0; i &lt; comments.length; i++) {
                   entry = comments[i];
                  if (entry.timestamp &gt; self.timestamp) {
                      self.timestamp = entry.timestamp;
                  }
                  vm.comments.unshift(entry);
              }
               self.getNewEntries();
          });
      };
  
  }
  
  function ViewModel(){
      var self = this;
  
      self.cSection=ko.observable(new commentSection());
      self.comments = ko.observableArray();
      self.selectedComment = ko.observable(new Comment());
  
      //self.cSection().getNewEntries();
  }
  var vm=new ViewModel();
  ko.applyBindings(vm);
  vm.cSection().getNewEntries();
  
  });
  </code></pre>