Skip to content
Advertisement

How can I check a checkbox depending on what row using jQuery?

What I have tried is to make a checkbox when clicked it automatically checks the other checkbox from it’s row but when I tried to check the other rows, it does not work. I’ve tried to make a loop but instead of checking each, it checks all. I hope someone can help me. Thank you so much in advance!

Here is my whole code, I am using dataTables

JavaScript
JavaScript

Advertisement

Answer

Ids are singular so you can not use an id multiple times. Change all of the ids to a class.

After you remove the ids and swap it to a class. You will need find the row the checkbox is in. And then select all the checkboxes in that row.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement