mardi 4 juillet 2017

Validate checkbox using JavaScript.

I would like some help with checkbox validation.

If you look in below picture, when user click the image, the checkbox becomes selected.

What I would want is if all checkbox are selected alert an simple message.

enter image description here

This is a code to select checkbox by clicking on an image.

        $( document ).ready(function() {

    $("#roll-<?php echo $row['id_vnr']; ?><?php echo $cut_counter; ?>").click (function(){
         var $$ = $(this)

          if( !$$.is('.checked')){
              $$.addClass('checked');

              $('#imgCheck-<?php echo $row['id_vnr']; ?><?php echo $cut_counter; ?>').prop('checked', true);

                }
            });
    });

So I can select check box by clicking on an image. How I can alert message if all check box are selected. Soon user click last picture, the picture will disappear, the red tick box will appear and user should see alert message.

Thank you in advance.




Aucun commentaire:

Enregistrer un commentaire