[Solved] Duplicate contents of a TD [closed]


One way:

$("button").click(function() {
  copy();
});

function copy() {
  $('tr').each(function() {
    $(this).find('td :input:not(:first)').val($(this).find('td :input:first').val()).prop('checked', $(this).find('td :input:first').prop('checked'))
  })
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<table>
  <tr>
    <td>
      <input type="text" value="abc" />
    </td>
    <td>
      <input type="text" value="def" />
    </td>
    <td>
      <input type="text" value="ghi" />
    </td>
  </tr>
  <tr>
    <td>
      <select>
        <option>
          123
        </option>
        <option selected="selected">
          456
        </option>
        <option>
          789
        </option>
      </select>
    </td>
    <td>
      <select>
        <option>
          123
        </option>
        <option>
          456
        </option>
        <option>
          789
        </option>
      </select>
    </td>
    <td>
      <select>
        <option>
          123
        </option>
        <option>
          456
        </option>
        <option>
          789
        </option>
      </select>
    </td>
  </tr>
  <tr>
    <td>
      <input type="radio" />
    </td>
    <td>
      <input type="radio" />
    </td>
    <td>
      <input type="radio" />
    </td>
  </tr>
  <tr>
    <td>
      <input type="checkbox" checked="checked" />
    </td>
    <td>
      <input type="checkbox" />
    </td>
    <td>
      <input type="checkbox" />
    </td>
  </tr>
</table>

<button>
  Copy
</button>

solved Duplicate contents of a TD [closed]