Jump to content

Can't Enter Text into Input Text


Jangrina

Recommended Posts

Hi All,

 

I created input text in a JavaScript function.

 

When I try in browser, I cannot enter text into those fields.

 

Can someone tell me why and how to solve this?

 

HTML File

In this file, a function crtTable() will be called to create rows, columns and input.

<form id="frmDetails" name="form1"><table id="tblDetails" border="1"><tr>	<td>YEAR</td>	<td><input class="txtName" type="TEXT" name="year" id="year"></td>	<td></td></tr><tr>	<td>NAME 1</td>	<td><input class="txtName" type="TEXT" name="name1" id="name1"></td>	<td></td><tr><tr>	<td>NAME 2</td>	<td><input class="txtName" type="TEXT" name="name2" id="name2"></td>	<td id="adder" onclick="addRow()">[+]</td></tr></table> <!--tblDetails--><br><input type="button" value="Create Table" onclick="crtTable()"></form><p id="pDetails"></p><table id="tblTax" border="1"><tbody id="btblTax" onclick="crtTable()"></tbody></table> <!--tblTax-->

JavaScript

All the input text created in below code, cannot be inserted with text.

 

Pls help.

        // row 2	var tr2 = tbody.insertRow(-1);	var td1 = tr2.insertCell(-1); td1.innerHTML = "Adjusted Income";		var td2 = tr2.insertCell(-1); 	var inp1 = document.createElement("input"); // input Adjusted Income 1	inp1.name = "inpAdjIncome1";	inp1.id = "inpAdjIncome1";	inp1.className = "txtCalc";	td2.appendChild(inp1);	var td3 = tr2.insertCell(-1);	var inp2 = document.createElement("input"); // input Adjusted Income 2	inp2.name = "AdjIncome2";	inp2.id = "AdjIncome2";	inp2.className = "txtCalc";	td3.appendChild(inp2);	var td4 = tr2.insertCell(-1); td4.innerHTML = "";	var td5 = tr2.insertCell(-1); td5.innerHTML = "";		if (numOfName > 2)	{		for (i=3; i<=numOfName; i++)		{			td = tr2.insertCell(-1); td.innerHTML = "";		}	}		// row 3	var tr3 = tbody.insertRow(-1);	var td1 = tr3.insertCell(-1); td1.innerHTML = "+ Balancing Charge";	var td2 = tr3.insertCell(-1); 	var inp1 = document.createElement("input"); // input Balancing Charge 1	inp1.name = "BalCharge1";	inp1.id = "BalCharge1";	inp1.className = "txtCalc";	td2.appendChild(inp1);	var td3 = tr3.insertCell(-1);	var inp2 = document.createElement("input"); // input Balancing Charge 2	inp2.name = "BalCharge2";	inp2.id = "BalCharge2";	inp2.className = "txtCalc";	td3.appendChild(inp2);	var td4 = tr3.insertCell(-1); td4.innerHTML = "";	var td5 = tr3.insertCell(-1); td5.innerHTML = "";
Link to comment
Share on other sites

Did you really read the prob?

 

The TOPIC is so much different, so, is the problem.

 

The thread that was resolved was something about adding rows.

 

And the topic resolved was "Problem with Add Row Dynamically".

 

Can't you see the difference?

 

But this thread is about Input Text.

 

My input text cannot work. They cant receive input.

 

If you don't want to help, don't say something like that.

Edited by Jangrina
Link to comment
Share on other sites

Sorry for the misunderstanding. I did want to help. I posted a long response. When I thought your problem was solved, I deleted the text because the forum does not allow me to delete the post. So I tried to explain why my post was there but didn't say anything.

 

Anyway, when I execute your code in Firefox, it creates a table, and the inputs accept text. When you say the inputs don't accept text, do you mean that when a user types, nothing appears? If a user clicks on the input, does the cursor begin to flash there?

 

It would be helpful if you post all the code or a link to your page.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...