The following code works on the latest version of Firefox, Chrome, Safari and IE but not on Opera. When I click on the add button using Opera, a very thin space seems to have been added to row, but nothing else... Can anyone help? The Form:
<form method="post" action="send.php">
<table id="table">
<tr><th>job</th><th>comment</th></tr>
<tr>
<td><textarea name = "job[]"></textarea></td>
<td><textarea name = "comment[]"></textarea></td>
<tr>
</table>
<input type ="button" value="add entry" onclick="add('table')"/>
<input type ="submit" id="submit" value="submit"/>
The JavaScript:
var names = ['job[]', 'comment[]'];
function add(tableID) {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var colCount = table.rows[0].cells.length;
for (var i=0; i<colCount; i++) {
var newcell = row.insertCell(i);
var newentry = document.createElement('textarea');
newentry.type = "text";
newcell.appendChild(newentry);
}
}
This line: newentry.type = "text";
causes an exception in Opera: Uncaught exception: DOMException: NO_MODIFICATION_ALLOWED_ERR
. The line does nothing anyway (at least in Chrome), so I guess you can remove it.
var newentry = document.createElement('textarea');
newentry.type = "text";
console.log(newentry.type);
-> textarea