title: How to assign class of html element to a javascript variable
body: <p>I am passing a javascript variable "name" to the following function:</p>
  
  <pre><code>function addCategory(name){
      $("#myTable").append('&lt;tr class=name&gt;&lt;td&gt;'+name+'&lt;/td&gt;&lt;td&gt;&lt;a onclick="" type="button" class="btn btn-xs" &gt;&lt;i class="glyphicon glyphicon-erase"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;');
  
      $('#postcat')[0].reset();
  
      }
  </code></pre>
  
  <p>If the 'name' variable contains the value "general", I want the class name to be "general" and not name.</p>
  
  <p>How should I do it?</p>