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..

Recommended Answers

All 2 Replies

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.