title: Add span tag with javascript function to html table
body: <p>I have a function in javascript to change the background color of some cells in a html table</p>
  
  <pre><code>&lt;script language="javascript"&gt;
  function GetAllValues() {
      var tbl = document.getElementById("monitor");
          for (var i = 0; i &lt; tbl.rows.length; i++){
                  if (parseInt(tbl.rows[i].cells[6].innerHTML) == 1){
                           tbl.rows[i].cells[5].style.backgroundColor = "green";
                  }else if (parseInt(tbl.rows[i].cells[6].innerHTML) == 2){
                          tbl.rows[i].cells[5].style.backgroundColor = "yellow";
                  }else if (parseInt(tbl.rows[i].cells[6].innerHTML) == 3){
                          tbl.rows[i].cells[5].style.backgroundColor = "red";
                  }else if (parseInt(tbl.rows[i].cells[6].innerHTML) == 5){
                          tbl.rows[i].cells[5].style.backgroundColor = "gray";
                  }else{
                          tbl.rows[i].cells[5].style.backgroundColor = "white";
                          }
  &lt;/script&gt;
  </code></pre>
  
  <p>But I need to add an "span" tag to the value of the cell like this:</p>
  
  <pre><code>&lt;span class="label label-success"&gt;table cell value&lt;/span&gt;
  </code></pre>
  
  <p>I don't know how to add this tag into the cell.</p>
  
  <p>Can you bring me some snippet or a link where I can take some ideas.</p>
  
  <p>Thanks in advance</p>