簡體   English   中英

將TextArea和Colspan添加到動態創建的表行

[英]Adding TextArea and Colspan to dynamically created table row

我正在跟蹤硬編碼表數據

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

但是我想使用Javascript或jQuery來做這件事,任何人都可以告訴我該怎么做。

去做就對了。

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);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM