title: Bootstrap tablesorter on php echo output
body: <p>I using tablesorter in twitter-bootstrap. This works fine when using like this:</p>
  
  <pre><code>        &lt;div class="table-responsive"&gt;
                &lt;table class="table table-bordered table-hover table-striped tablesorter"&gt;
                  &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Brugernavn &lt;i class="fa fa-sort"&gt;&lt;/i&gt;&lt;/th&gt;
                      &lt;th&gt;Rolle &lt;i class="fa fa-sort"&gt;&lt;/i&gt;&lt;/th&gt;
                      &lt;th&gt;Oprettet &lt;i class="fa fa-sort"&gt;&lt;/i&gt;&lt;/th&gt;
                    &lt;/tr&gt;
                  &lt;/thead&gt;
                       &lt;tbody&gt;
                    &lt;tr&gt;
                      &lt;td&gt;3326&lt;/td&gt;
                      &lt;td&gt;10/21/2013&lt;/td&gt;
                      &lt;td&gt;3:29 PM&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                      &lt;td&gt;3325&lt;/td&gt;
                      &lt;td&gt;10/21/2013&lt;/td&gt;
                      &lt;td&gt;3:20 PM&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                      &lt;td&gt;3324&lt;/td&gt;
                      &lt;td&gt;10/21/2013&lt;/td&gt;
                      &lt;td&gt;3:03 PM&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                      &lt;td&gt;3323&lt;/td&gt;
                      &lt;td&gt;10/21/2013&lt;/td&gt;
                      &lt;td&gt;3:00 PM&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                      &lt;td&gt;3322&lt;/td&gt;
                      &lt;td&gt;10/21/2013&lt;/td&gt;
                      &lt;td&gt;2:49 PM&lt;/td&gt;
  
                    &lt;/tr&gt;
                  &lt;/tbody&gt;
  
  
                &lt;/table&gt;
  </code></pre>
  
  <p>This works and my Console shows:</p>
  
  <pre><code>    event.returnValue is deprecated. Please use the standard event.preventDefault() instead. jquery-1.10.2.js:5
  Evaling expression:var sortWrapper = function(a,b) {var e0 = (a[0] === null &amp;&amp; b[0] === null) ? 0 :(a[0] === null ? Number.POSITIVE_INFINITY : (b[0] === null ? Number.NEGATIVE_INFINITY : a[0] - b[0]));if(e0) { return e0; } else { return a[4]-b[4];}; return 0; }; ,0ms jquery.tablesorter.js:147
  Sorting on 0,0 and dir 0 time:,1ms jquery.tablesorter.js:147
  Rebuilt table:,0ms  
  </code></pre>
  
  <p>But when I use data from my Mysql database and loop through, it does not work.</p>
  
  <p>I do it like this:</p>
  
  <pre><code>               &lt;table class="table table-bordered table-hover table-striped tablesorter"&gt;
                  &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Brugernavn &lt;i class="fa fa-sort"&gt;&lt;/i&gt;&lt;/th&gt;
                      &lt;th&gt;Rolle &lt;i class="fa fa-sort"&gt;&lt;/i&gt;&lt;/th&gt;
                      &lt;th&gt;Oprettet &lt;i class="fa fa-sort"&gt;&lt;/i&gt;&lt;/th&gt;
                    &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;?php 
                  foreach ($users as $key =&gt; $value) {
                      ?&gt;
                      &lt;tbody&gt;
                      &lt;tr  data-id="&lt;?php echo $value['user'];?&gt;" data-toggle="modal" data-target="#edit" class="open-edit"&gt;
                      &lt;td data-id="username" class="username-edit"&gt;&lt;?php echo $value['user'];?&gt;&lt;/td&gt;
                      &lt;td class="username-edit" data-id="role"&gt;&lt;?php echo $value['role'];?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $value['lastlogin'];?&gt;&lt;/td&gt;
                      &lt;/tbody&gt;
                      &lt;?php 
                  }
  
                   ?&gt;
  
                &lt;/table&gt;
  </code></pre>
  
  <p>The data gets show correct but when I click the sort button nothing happends. The Console shows:</p>
  
  <pre><code>event.returnValue is deprecated. Please use the standard event.preventDefault() instead. jquery-1.10.2.js:5
  Evaling expression:var sortWrapper = function(a,b) {var e0 = (a[0] == b[0] ? 0 : (a[0] === null ? Number.POSITIVE_INFINITY : (b[0] === null ? Number.NEGATIVE_INFINITY : (a[0] &lt; b[0]) ? -1 : 1 )));if(e0) { return e0; } else { return a[3]-b[3];}; return 0; }; ,0ms jquery.tablesorter.js:147
  Sorting on 0,0 and dir 0 time:,1ms jquery.tablesorter.js:147
  Rebuilt table:,0ms 
  </code></pre>
  
  <p>Can anyone help me understand why the sort function does not work when using my php loop?</p>