javascript - Retrieving value from a textbox in HTML table -


I have a table with a text box in its cells, all these text boxes were dynamically created using PHP and Has been populated. I have to be repeated through cells and get value.

Using the following code, I am capable of receiving internal cells.

  var tblLang = document .getElementById ("tbl_Languages"); Var tblrows = tblLang.rows; For (var i = 1; i  

Output for the given code

  & lt; Input background-color = "#fffff" hailout = "- 1" id = "txtname_ENU" value = "english" type = "text" & gt;  

How do I get the value of the inner textbox? Please help me

You want to get the actual dome node from the table cell instead of the internal HTML (wire). This will allow you to call. Value on that node and something like you are all good:

  tblcells [0] .firstChild.value // or iterate through the children to repeat lang = tblcells.childNodes.length (var I = 0; i & lt; childLength; i ++) {Warning (tblCells.childNodes [i] .Value); }  

Also keep in mind that when you restart (var i = 1; i & lt; tblrows.length; i ++) Code> You are checking the length of your tblrows array is slow every time you should first check that length like your code, then use it in the loop.


Comments