【问题标题】:Adding TextArea and Colspan to dynamically created table row将 TextArea 和 Colspan 添加到动态创建的表格行
【发布时间】:2012-03-24 11:32:19
【问题描述】:

我有以下硬编码的表格数据

 <td colspan="4">
   <textarea rows="4" cols="40"></textarea>
 </td>

但我想使用 Javascript 或 jQuery 来做这件事,谁能告诉我怎么做。

【问题讨论】:

    标签: javascript html-table textarea


    【解决方案1】:

    去做吧。

    var td = document.createElement('td');
    
    td.setAttribute('colspan', '4');
    
    var textarea = document.createElement('textarea');
    
    textarea.setAttribute('rows', '4');
    textarea.setAttribute('cols', '40');
    
    td.appendChild(textarea);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多