title: How to return JSON as a string object using nestable plugin?
body: <p>My code is used to make a nestable drag and drop menu, and after changes are made using the drag-and-drop functionallity the JSON is written to a textarea. How can I return this string value to a variable instead of pusing it into the textarea?</p>
  
  <p><strong>Html code:</strong> </p>
  
  <pre><code>&lt;textarea id="nestable-output"&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p><strong>The jquery code:</strong></p>
  
  <pre><code>$(document).ready(function() {
      var updateOutput = function(e) {
          var list   = e.length ? e : $(e.target),
              output = list.data('output');   
  
          if (window.JSON) {
              output.val(window.JSON.stringify(list.nestable('serialize')));              
          } 
      };
  
      // activate Nestable for list 1
      $('#nestable').nestable({
          group: 1
      })
      .on('change', updateOutput);
  
  
      // output initial serialised data to textarea
      updateOutput(
          $('#nestable').data('output',
          $('#nestable-output'))
      );
  });
  </code></pre>