Tuesday 15 March 2011

javascript - Getting cell value from table in jQuery -


I do not have an ID or name inside a table. How do I read values ​​from the desired table cell in jQuery? For example:

  & lt; Div id = "myDiv" style = "padding-top: 0px; height: 60px;" & Gt; & Lt; Width of table = "264" cell field = "0" cell padding = "0" range = "0" & ​​gt; & Lt; Tbody & gt; & Lt; TR & gt; & Lt; Td width = "80" height = "20" style = "font-size: 10px;" & Gt; & Lt; / TD & gt; & Lt; Td id = "the_cell_i_want" align = "right" style = "color: RGB (102, 188, 41); font-size: 24px; font-weight: bold; background color: RGB (255, 255, 255); background - Image: None; "& gt; THE_VALUE_I_WANT & lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Div & gt;  

I want to get the ID from "the_cell_i_want" ID and return it to "THE_VALUE_I_WANT".

$ ("# the_cell_i_want"). Text ();

This will do it for you.

Since you have an ID, you can specifically select the element from the dome. And you can use cell value [internal text].


No comments:

Post a Comment