mercredi 5 décembre 2018

How to print a new value of a checkbox after having checked it?

I built a form in which I populated checkboxes with values stored in a PostGreSQL database (you can see the snippet). The checkbox are checked or not checked automatically. Now, if I choose another value of the checkbox, I'd like to display it in an "alert" or "console.log" print.
How could I do in Javascript or Jquery ?

Thanks tou very much for the help !

    <div class="form-row">
    <div id="man-compo" class="form-group col-md-12">
    <label for="exampleInputPassword1">Composition (le texte hagiographique est composé de) :</label><br>          
         <?php
          foreach ($checked116 as $value) {  
             $array12 = array("Textes historiographiques","Actes de la pratique","Textes grammaticaux","Lettres et ars dictaminis","Vers et inscriptions métriques","Lexique","Comput","Algèbre et géométrie","Autres");
             $checked = "";
             if(in_array($value, $array12)){
                $checked = "checked";
                  echo '<input type="checkbox" id= "checked-man-compo-compo-1" name="checkedmancompocompo1[]" value="'.$value.'" '.$checked.' > '.$value.' <br/>';
                }
             }
           foreach ($array12 as $i) {
             $checked = "";
             if(in_array($i, $checked116)){
             }
             else {
             echo '<input type="checkbox" id= "notchecked-man-compo-compo-1" name="notcheckedmancompocompo1[]" value="'.$i.'" '.$checked.' > '.$i.' <br/>';
             }
           }
          ?>




Aucun commentaire:

Enregistrer un commentaire