在HTML中添加多行而无需重写代码

时间:2018-08-22 20:41:01

标签: javascript html angular

我希望在HTML中重复同一行10次,每个tr和td具有唯一索引。是否有任何Javascript或Angular解决方案。

HTML

   <table class="table table-bordered" border="1">
    <thead>
     <tr>
      <th id= '0'> first row </th>
      <th id='1'> second row</th>
      <th id='2'> third head</th>
      <th id='3'> fourth head</th>
      <th id='4'> fifth head</th>
      <th id='5'> 6th head</th>
      <th id='6'> 7th head</th>
      <th id='7'> 8th head</th>
      <th id='8'> 9th head</th>
      <th id='9'> 10th head</th>
    </tr>
    </thead>
    <tbody>

    <tr id="container">  <!-- Repeat 10 times-->
      <td contenteditable="true"></td>
      <td contenteditable="true"></td>
      <td contenteditable="true"></td>
      <td contenteditable="true"></td>
      <td contenteditable="true"></td>
      <td contenteditable="true"></td>
      <td contenteditable="true"></td>
      <td contenteditable="true"></td>
      <td contenteditable="true"></td>
      <td contenteditable="true"></td>
    </tr>
   </tbody>
   </table>

https://embed.plnkr.co/RJjeU1MxdPDIfu4txXGw/

0 个答案:

没有答案