node.js - How can I get data from table using parent() -


i try data table, there link "kaydet" when click it, must data table belong row, share table, below: https://hizliresim.com/pb3dmv

sozlesme.js

template.sozlesmelistele.events({     'click .kaydet': function (event, template) {         event.preventdefault();         var sozlesmebilgilerial = $(event.currenttarget).parent().parent().find(".secilenarac");         savesozlesmebilgisi = sozlesmebilgilerial.val();         alert(savesozlesmebilgisi);     } }); 

sozlesmeal.html

<tbody>     {{#each sozlesmelist}}     <tr>         <td>{{kullaniciadi}}</td>         <td>{{rezervasyonnumarasi}}</td>         <td>{{kiradakalicakgun}}</td>         <td>{{telefon}}</td>         <td>{{alistarihi}}</td>         <td>{{iadetarihi}}</td>         <td class="secilenarac">{{secilenarac}}</td>         <td>{{aracteslimadresi}}</td>         <td>{{odenecektutar}} tl.</td>         <td>ceyhun tekİn</td>         <td> <a href="javascript:;" class="kaydet">kaydet</a></td>       </tr>     {{/each}} </tbody> 

how can solve it?

deciphering turkish javascript new challenge me if i'm reading question correctly, want figure out row clicked , data row, correct?

the simplest solution break template outer list-level 1 , inner, row-level one. can react click events on row , data context automatically. no need try figure out row clicked on.

template.teksozlesme.events({   'click .kaydet': function (event, template) {     event.preventdefault();       console.log(this); <!-- *this* row data context       ...   } });  <template name="sozlesmelistele">   <tbody>     {{#each sozlesmelist}}       {{> teksozlesme }}     {{/each}}   </tbody> </template>  <template name="teksozlesme">   <tr>     <td>{{kullaniciadi}}</td>     <td>{{rezervasyonnumarasi}}</td>     <td>{{kiradakalicakgun}}</td>     <td>{{telefon}}</td>     <td>{{alistarihi}}</td>     <td>{{iadetarihi}}</td>     <td class="secilenarac">{{secilenarac}}</td>     <td>{{aracteslimadresi}}</td>     <td>{{odenecektutar}} tl.</td>     <td>ceyhun tekİn</td>     <td><a href="#" class="kaydet">kaydet</a></td>   </tr> </template> 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -