jeudi 23 janvier 2020

How to get the value of checkbox through jquery in a dynamic grid?

[dynamic grid[1]

This is my dynamic grid. I am trying to get the value of checkboxes against Customer Description. That is if the checkbox is checked it saves Y in database and if the checkbox is false, it saves N in database. Below is the code what I am trying to do:

        var BusinessList = '';
        var cusid='' ,cuscheckbox = '', CustomerDescription='';

        $('#tblCustomerDetail tbody tr').each(function () {

             if ($.trim($(this).find('td:eq(0)').html()) != "No Data.") {

                 cusid = $(this).attr('pkid');

                 cuscheckbox = $(this).find('td:eq(1)').find('#txtcuscheckbox_').is(":checked");


                 CustomerDescription = $(this).find('td:eq(2)').find('text').val();
                 BusinessList += cusid + "♥" + cuscheckbox + "♥" + CustomerDescription + "♠";
             }

         });

This actually iterates through the whole grid row by row and gets their value. I am getting cusid but cuscheckbox is always returning false. Can anyone please modify the code above to that it gets the value of checkbox against Customer Description? I am new at this and I don't know how to do this.




Aucun commentaire:

Enregistrer un commentaire