Reading hidden values
Reading hidden values
Hi,
I have populated my table with a student names and a checkbox (active/inactive).
When the admin clicks the Update button, I need to read through all students and update the database.
If the admin has searched by surname (E.g Bloggs), the non-matching students are hidden from view.
When I try to read through the checkboxes, I'm only able to pickup those that are showing at that time ('Joe bloggs').
I'm using the following code:
$('[id^="student-id-"]').each(function () {
alert($(this).val());
});
How can I read through all the rows/checkboxes?
Thanks
Answers
Are you using Datatables?
Its hard to tell with the above code and description. If you are using Datatables then please post the relevant JS code showing the Datatables and how you are searching and handling the checkboxes.
Kevin
Hi Kevin,
Thanks for the reply.
I'm creating the datatable using:
The table has 3 columns, the checkboxes are in columns 2 and 3. The admin is the one who searches, using the search box (the default search box included with the datatable script).
The row is as follows:
<tr>
<td>Joe Bloggs</td>
<td>
<label class="mt-checkbox mt-checkbox-single mt-checkbox-outline">
<input type="checkbox" class="checkboxes" id="student-id-09" value="309" checked /><span></span></label>
</td>
<td>
<label class="mt-checkbox mt-checkbox-single mt-checkbox-outline">
<input type="checkbox" class="checkboxes" id="example-id-309" value="309" checked /><span></span></label>
</td>
</tr>