Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi frens i want a small help

this is my code for adding textbox dynamically using javascript

JavaScript
function addRow(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);

               newcell.innerHTML = table.rows[0].cells[i].innerHTML;
               //alert(newcell.childNodes);
               switch(newcell.childNodes[0].type) {
                   case "text":
                           newcell.childNodes[0].value = "";
                         /////  newcell.childNodes[0].name.class="txt";

                           break;



the commented line is added by me

i want to have the newly formed textbox class name as txt because i have to use its value for addition in another method call. i am not able to do it


please suggest with some solutions

with regards bishnu
Posted
Updated 8-Feb-12 23:11pm
v2

1 solution

Use className instead of class
FYI Handling CSS by using Javascript/jQuery[^]
 
Share this answer
 
Comments
Espen Harlinn 9-Feb-12 8:39am    
5'ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900