mercredi 29 novembre 2017

Count Checkboxes using JQuery. Not Working

I have a table with some checkboxes and I need to make a count every time 1 is selected. I have 2 lines and I have to count each line separately.

Here are the checkboxes:

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

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

The goal is always that 1 is selected it counts in real time and puts the result here:

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

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

For this and thanks to the help of a user of this community, I am using the following jquery code:

$('.denteCheck-up').change(function() {
  $('#count_dentes_up').text($('.denteCheck-up:checked').length);
});

$('.denteCheck-down').change(function() {
  $('#count_dentes_down').text($('.denteCheck-down:checked').length);
});

The problem is that in code snippets it works wonderfully but I can not get it to work at all. To help I'm using Laravel 5.4 and I'm incorporating the following scripts:

    

    
    <script src="http://ift.tt/2nfkus0" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="http://ift.tt/2zAEitV" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
    <script src="http://ift.tt/2iF8Hmw" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>

    
    <script src="http://ift.tt/2hmjuMy"></script>

    
    <script src=""></script>

    
    <script src=""></script>

    
    <script src="http://ift.tt/2rGRyYw"></script>




Aucun commentaire:

Enregistrer un commentaire