Table add rows in all browsers except Internet Explorer

Hi,

I have a function where it add rows into a table. For the example below it adds a row under the Question column, (I have not included whole function as there is a lot of code so instead I have just posted the relevant code.

//This is inside a function

var row = document.createElement("tr");
	var cell
        input,
        alertErrors = "",
        // Note, this is just so it's declared...
        qnum = 1;

 cell = document.createElement("td"),
        input = document.createElement("textarea");
    cell.className = "question";
    input.name = "question_" + qnum;
    input.value = form.questionText.value;
    cell.appendChild(input);
    row.appendChild(cell); 

Now my function works really well when it comes to adding a row into a table. The problem is that it works on all major browsers except for Internet Explorer. I have researched an found out that I may need to use insertRow() and insertCell() methods. I don’t know how to really apply this into my code so what I want to know is that if somebody knows how to manipulate the code above to include the insertRows and insertCell methods, then can you please do this for the code above. It means I know how insertRow() and insertCell is added in the code and I can include this in all of my other columns in the function.

Thank You :slight_smile:

This w3schools tute gives a good description and example code for insertRow() (saves me a lot of typing)

If you wrote the code you posted, the above tute should be straight forward for you.