javascript - Get text's tags under this -


i have code

javascript:

var j = jquery.noconflict(); j('#example tr').click( function() {   //here code want } ); 

html:

<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">         <thead>             <tr>                 <th>immat</th>                 <th>marque</th>                 <th>modèle</th>                 <th>contrat</th>                 <th>début contrat</th>                 <th>fin contrat</th>                 <th>coûtht/mois</th> </tr>   <tr class="odd gradea">                 <td>2257yy64</td>                 <td>citroen</td>                 <td>c3</td>                 <td>star lease</td>                 <td>27/04/2009</td>                 <td>27/04/2010</td>                 <td>270,02</td>             </tr>             <tr class="odd gradea">                 <td>2257yy64</td>                 <td>citroen</td>                 <td>c3</td>                 <td>star lease</td>                 <td>27/04/2009</td>                 <td>27/04/2010</td>                 <td>270,02</td>             </tr>             <tr class="odd gradea">                 <td>2257yy64</td>                 <td>citroen</td>                 <td>c3</td>                 <td>star lease</td>                 <td>27/04/2009</td>                 <td>27/04/2010</td>                 <td>270,02</td>             </tr> 

in loop want text ( text() method ) of each td tag under tr tab user had clicked.

how can ?

use .find , .eachh solve problem.

j('#example tr').click( function() {   j(this).find("td").each(function() {       alert(j(this).text()); // or whatever else want text   }); }); 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -