Seb
Seb

Reputation: 1113

Hide multiple selected rows with jquery

Hi I've got a table populated by a mysql query with a checkbox in the first column.

while ($dsatz = mysql_fetch_assoc($res)) {        
    echo '<tr>';
    echo '<td style="width: 3%;"><input type="checkbox" name="checkbox[' . $lf . ']"/></td>';
    echo '<td style="width: 19%;"><strong>' . $dsatz["name"] . '</strong></td>';
    echo '</tr>';
    $lf = $lf + 1;
} 

I would like to hide all selected rows with one click on a link/button at the bottom of the table.

This should be possible via css (display: none) an jquery. but how would I do it?

Thanks for your help! Seb

Upvotes: 0

Views: 81

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

You can try

$('yourbutton').click(function(){
    $('#yourtable tr').has('input[type="checkbox"]:checked').hide()
})

Upvotes: 2

Related Questions