mercredi 29 novembre 2017

How to count checkboxes using jQuery?

I'm doing a dashboard in Laravel 5.4, and I have a table with several checkboxes. I need to count each time 1 is selected and show the result on the side.

Basically I have to count in real time. And I have 2 lines, I have to count them separately, so I have separate classes

I've tried some things but nothing works.

Thanks in advance for help and ideas on how I can do this, below I leave the code of my checkbox.

{!! Form::checkbox('dente[]', $dente->id, null, ['class'=>'denteCheck-up'] ) !!}

{!! Form::checkbox('dente[]', $dente->id, null, ['class'=>'denteCheck-down'] ) !!}

In jquery, I've tried +/- this

$('.denteCheck-up').change(function(){ });

$('.denteCheck-down').change(function(){ });

I'm trying to get the result to appear here

<td id="count_dentes_up"></td>

<td id="count_dentes_down"></td>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire