title: Pull th content into a td data-label attribute
body: <p>I'm using a responsive table style that will collapse for smaller screen sizes and display the table header before each cell.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body {
    font-family: "Open Sans", sans-serif;
    line-height: 1.25;
  }
  table {
    border: 1px solid #ccc;
    border-collapse: collapse;
    margin: 0;
    padding: 0;
    width: 100%;
    table-layout: fixed;
  }
  table caption {
    font-size: 1.5em;
    margin: .5em 0 .75em;
  }
  table tr {
    background: #f8f8f8;
    border: 1px solid #ddd;
    padding: .35em;
  }
  table th,
  table td {
    padding: .625em;
    text-align: center;
  }
  table th {
    font-size: .85em;
    letter-spacing: .1em;
    text-transform: uppercase;
  }
  @media screen and (max-width: 600px) {
    table {
      border: 0;
    }
    table caption {
      font-size: 1.3em;
    }
    table thead {
      border: none;
      clip: rect(0 0 0 0);
      height: 1px;
      margin: -1px;
      overflow: hidden;
      padding: 0;
      position: absolute;
      width: 1px;
      color: red;
      background-color:#000;
    }
    table tr {
      border-bottom: 3px solid #ddd;
      display: block;
      margin-bottom: .625em;
    }
    table td {
      border-bottom: 1px solid #ddd;
      display: block;
      font-size: .8em;
      text-align: right;
    }
    table td:before {
      /*
      * aria-label has no advantage, it won't be read inside a table
      content: attr(aria-label);
      */
      content: attr(data-label);
      float: left;
      font-weight: bold;
      text-transform: uppercase;
    }
    table td:last-child {
      border-bottom: 0;
    }
    table td:first-child{
      color:white;
      background: #000;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table&gt;
    &lt;caption&gt;Statement Summary&lt;/caption&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th scope="col"&gt;Account&lt;/th&gt;
        &lt;th scope="col"&gt;Estimated arrival date&lt;/th&gt;
        &lt;th scope="col"&gt;Amount&lt;/th&gt;
        &lt;th scope="col"&gt;Period&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td data-label="Account"&gt;Visa - 3412&lt;/td&gt;
        &lt;td data-label="Really freaking long div magic"&gt;04/01/2016&lt;/td&gt;
        &lt;td data-label="Amount"&gt;$1,190&lt;/td&gt;
        &lt;td data-label="Period"&gt;03/01/2016 - 03/31/2016&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td scope="row" data-label="Account"&gt;Visa - 6076&lt;/td&gt;
        &lt;td data-label="Due Date"&gt;03/01/2016&lt;/td&gt;
        &lt;td data-label="Amount"&gt;$2,443&lt;/td&gt;
        &lt;td data-label="Period"&gt;02/01/2016 - 02/29/2016&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td scope="row" data-label="Account"&gt;Corporate AMEX&lt;/td&gt;
        &lt;td data-label="Due Date"&gt;03/01/2016&lt;/td&gt;
        &lt;td data-label="Amount"&gt;$1,181&lt;/td&gt;
        &lt;td data-label="Period"&gt;02/01/2016 - 02/29/2016&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>The column header is represented using the data-label attribute on each corresponding table cell. In the CSS, it's called with content: attr(data-label). I'm applying this style to some pretty large tables and I don't want to have to write the data-label for every single cell in the HTML. Is there a way to pull the th into the data-label attribute using Javascript?</p>