Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
  <head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jscolor/2.0.4/jscolor.min.js"></script>
  </head>
  <body>
    <button onclick="add_row_to_table()">Add Row</button>
    <table>
      <thead>
        <tr><th>Colour</th></tr>
      </thead>
      <tbody id="tableBody">
        <tr><td><input class="jscolor"></td></tr>
      </tbody>
    </table>
    <script type="text/javascript">
      function add_row_to_table(p) {
        tableBody = document.getElementById('tableBody');
        newRow = document.createElement('tr');
        colourCell = document.createElement('td');
        colourWidget = document.createElement('input');
        colourWidget.setAttribute('class', 'jscolor');
        colourCell.appendChild(colourWidget);
        newRow.appendChild(colourCell);
        tableBody.appendChild(newRow);
        new jscolor(colourWidget);
      }
    </script>
  </body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
dennisseahpro
0viewers