title: Add div Dynamically
body: <p>I have a table that adds rows dynamically as new users become active. The function will add a new row that displays the user's name and a button that activates a lightbox to show more information. The name and button are put in a single cell, but I'd like to right align the button and left align the name within the cell. I found this post <a href="https://stackoverflow.com/questions/2089820/right-align-and-left-align-text-in-same-html-table-cell">Right align and left align text in same HTML table cell</a> that shows how to do it with divs in HTML, but I need to do this dynamically. Anyone have a guess? I tried the following code, it works, but doesn't justify the name and button how I'd like. It just centers them within the cell. I'd appreciate any help. </p>
  
  <pre><code>function addRow(tableID, user, phone, age, city, zipCode) {
  
      var table = document.getElementById(tableID);
  
      var rowCount = table.rows.length;
      var row = table.insertRow(rowCount);
  
      var colCount = table.rows[0].cells.length;
  
      for(var i=0; i&lt;colCount; i++) {
  
           tabbody=document.getElementsByTagName("tbody").item(2);
           cell1 = document.createElement("TD"); //Create New Row
           leftDiv = document.createElement("div"); //Create left div
           leftDiv.id = "left"; //Assign div id
           leftDiv.setAttribute("style", "float:left;width:50%;"); //Set div attributes
  
           rightDiv = document.createElement("div"); //Create right div
           rightDiv.id = "right"; //Assign div id
           rightDiv.setAttribute("style", "float:right;width:50%;"); //Set div attributes
  
           user_name = document.createTextNode(user + ' '); //Set user name
  
           details_btn = document.createElement("button"); //Create details button
           btn_txt = document.createTextNode("Details"); //Create button text
           details_btn.appendChild(btn_txt);  //Add "Details" to button text
           details_btn.onclick = function(){moreInfo(user, phone, age, city, zipCode);}; //Assign button function
  
           cell1.appendChild(leftDiv);
           cell1.appendChild(user_name); //Add name to row
           cell1.appendChild(rightDiv);
           cell1.appendChild(details_btn); //Add button to row
           row.appendChild(cell1); //Add row to table
           tabbody.appendChild(row);
  
          var newcell = row.insertCell(i);
  
          newcell.innerHTML = table.rows[0].cells[i].innerHTML;
      }
  }
  </code></pre>