mercredi 12 octobre 2016

get HTML 5 row data on checkbox check

I have read and tried to applied some solution , but they are not working due to different table structure ..

I am simple trying to get table row elements values on checkbox check

this is sample of my table

<table class="wp-list-table widefat fixed striped users">

    <tbody id="the-list" data-wp-lists="list:user">

    <tr id="user-18">
    <th scope="row" class="check-column">
    <label class="screen-reader-text" for="user_18">Select abc</label>
    <input type="checkbox" name="users[]" id="user_18" class="subscriber" value="18">
    </th>


    <td class="username column-username has-row-actions column-primary" data-colname="Username">

    <td class="name column-name" data-colname="Name">abc </td>
</tbody>
    </table>

I have search some post and tried to create some function

$('#changeit').click(function(){
 alert('1')   ; //this is hitting
        var values = [];
        $("#the-list input[name=users[]]:checked").each(function(){
       alert('2')   ;               
         row = $(this).closest("tr");


        });

    });

and this

 $('#changeit').click(function(){
 alert('1')   ; //this is hitting
        var values = [];

        $(".wp-list-table input[name=users[]]:checked").each(function(){
        alert('2')   ;
            row = $(this).closest("tr");


        });

    });

But these codes doesnt enter inside checkbox checked function , i am not able to figure out what is missing. Any suggestion will be helpful




Aucun commentaire:

Enregistrer un commentaire