javascript - How to get the content of a table rows and columns -


can give me idea on how count table column , table row , id, attribute , content of each cell (the cell contenteditable). tools have use.

e.g.

<table> <tbody> <tr>  <td id='1a' rowspan=2>rowspan 2</td>  <td id='1b'>22222</td>  <td id='1c'>33333</td> </tr>  <tr>    <td id='2b' colspan='2'> colspan2</td>       </tr> <tr>  <td id='3a' style='color:red'>whaterver</td>  <td id='3b' style='font-weight:bold'>askyourmother</td>  <td id='3c'>sigh</td> </tr> </tbody> </table> 

i'm using jquery (javascript).

you can make use of jquery , whatever want it. in case print in console.

//for each tr... $('table tr').each(function(){      //for each td....     $(this).find('td').each(function(){          console.log($(this).text());  //do whatever want text          console.log($(this).attr('id'));            console.log($(this).attr('any_other_attribute'));       }); }); 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -