0

hi guys, i am generating a certain element using javascript inside a table..
now, my problem is that, inside a cell, i will input a text and a textbox..
if the sequence is like this, text textbox both displays in the screen,
if it's like this, textbox text only the text displays..

could you help me?

var table = document.getElementById(tableID); 
	var rowCount = table.rows.length;
	var row = table.insertRow(rowCount);  
	
	var cella = row.insertCell(0);
	cella.style.backgroundColor = "EAEAEA";
	var element1 = document.createElement("textarea");
	element1.cols = "9";
	element1.rows = "3";
	element1.name = "txtDescription[]";
	element1.size = "10";
	cella.style.fontWeight = "Bold";
	cella.innerHTML = "UNIT ";
	cella.appendChild(element1);

this code works, what i want to happen is the reverse, textbox and then text..
like this one..

Attachments Image11.png 0.37 KB
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by xuexue
0

try "APPENDING" the text. If you just swap the lines you have, then you would be overwriting the textarea with the text:

var table = document.getElementById(tableID); 
	var rowCount = table.rows.length;
	var row = table.insertRow(rowCount);  
	
	var cella = row.insertCell(0);
	cella.style.backgroundColor = "EAEAEA";
	var element1 = document.createElement("textarea");
	element1.cols = "9";
	element1.rows = "3";
	element1.name = "txtDescription[]";
	element1.size = "10";
	cella.style.fontWeight = "Bold";
	cella.appendChild(element1);
	cella.innerHTML += "UNIT ";
0

thanks sir!
this was a wonderful Christmas gift..
i already got it!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.