Ravi Ravi - 3 months ago 11x
Javascript Question

How to select all checkbox and get value in jquery

In foreach loop there is checkbox for each row.

Code As Bellow.

foreach($rpd_records as $rpd_newslater_records)
$rp_ne_value = maybe_unserialize($rpd_newslater_records->meta_value); ?>
<input type="hidden" class="rpd_meta_id" name="rpd_meta_id" value="<?php echo $rp_ne_records->meta_id; ?>">
<td><input type="checkbox"></td>
<td><?php echo $rp_ne_value['product_id']; ?></td>
<td> <div class="send_mail_btn" style="display: inline;">
<a href="javascript:void(0)" class="rpd_send_it">Send</a></div></td>
} ?>

<button type="button" id="sendAll" class="main"><span class="sub"></span> Send All </button>

What I should : when i click on SendAll Button then its all checkbox are selected and get each of Row Hidden Value using Jquery.

Can you suggest me.



This will help you;

$("#sendAll").click(function(e) {
    $(":checkbox").attr("checked", true);    

    var values = $('input.rpd_meta_id[type="hidden"]').map(function(){
        return this.value;