1
I need to calculate table items and show in a given field of my page.
There is a search field with some filters, as it is researched appear the patients in the table, with the event I wanted to hear the patients as they are researched and show the result (number of patients who were found) in another field.
The id="countPatients" is a < span > where the number of patients surveyed should appear.
.patient-table-plugin is my table
My event at . js is like this:
Pacientes.prototype = {
$('.pacientes-table-plugin').on('change', function(){
self.count_pac();
});
}
And my function so:
count_pac : function(){
const t = $('.pacientes-table-plugin tr').length;
$('#countPacientes').text(t);
}
But my event is not working
You want to count the number of rows, columns or cells?
– Máttheus Spoo
Possible duplicate of Calculate items from a table
– Pedro Augusto
Better continue editing your original question instead of opening two new questions with the same content.
– Pedro Augusto
The amount of lines
– Tha