Vishal Patwardhan
Vishal Patwardhan

Reputation: 317

Adding TextArea and Colspan to dynamically created table row

I am having following hardcoded table data

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

but I want to do this thing using Javascript or jQuery can anyone tell me how to do this.

Upvotes: 2

Views: 4718

Answers (1)

user1150525
user1150525

Reputation:

Just do it.

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

Upvotes: 1

Related Questions