I need to calculate the table items and display them in a certain field on my page.
There is a search field with some filters, as it is searched the patients appear in the table, with the event I wanted to listen to the patients as they are searched and show the result (number of patients that were found) in another field. p>
The id="countPatients" is a < span> where the number of patients surveyed should appear.
.pacientes-table-plugin is my table
My event in .js looks like this:
Pacientes.prototype = {
$('.pacientes-table-plugin').on('change', function(){
self.count_pac();
});
}
And my function like this:
count_pac : function(){
const t = $('.pacientes-table-plugin tr').length;
$('#countPacientes').text(t);
}
But my event is not working