title: make a insert function for bracket.js
body: <p>I'm a making <strong>function that replace null by another word/value</strong>.</p>
  
  <p>the var in question : </p>
  
  <pre><code>var saveData = {"teams":[[null,null],[null,null]]}
  </code></pre>
  
  <p>I find out that the variable is a <strong>2D array</strong> and to acces a null I shoud do <strong>savedata.teams[0][0]</strong> so i made a script that modify the variable.</p>
  
  <pre><code>function add(team, data) 
  {
      var str = team.innerHTML;
      var str = str.replace(/&lt;td&gt;/g, "");
      var text = str.split("&lt;/td&gt;");
  
      var i = 0;
  
  
  
      while(data.teams[i][0] != null || data.teams[i][1] != null)
      {
          i++;
      }
  
      if( i == data.teams.length - 1){}
  
  
      if(data.teams[i][0] == null)
      {
          data.teams[i][0]  = text[1];
      }
      else if(data.teams[i][0] != null)
      {
          data.teams[i][1] == text[1];
      }
  
      $(function() {
          var container = $('.creator')
          container.bracket({
              init: data,
              save: saveFn,
              userData: ""})
      })
  }
  </code></pre>
  
  <p>the result is wierd. it output :</p>
  
  <ul>
  <li><p>first use : </p>
  
  <p>{"teams":[["team 1",null],[null,null]]}</p></li>
  <li><p>seconde use : </p>
  
  <p>{"teams":[["team 1",null],["team 2",null]]} </p></li>
  </ul>
  
  <p>I don't know why, but I suspect <strong>the error may come from the while</strong> or the <strong>if</strong></p>