samedi 21 juillet 2018

How to get multiple checkboxes values using id

I have a list of checkboxes with different values.

<input type="checkbox" value="55" id="myId">
<input type="checkbox" value="65" id="myId">
<input type="checkbox" value="75" id="myId">
<input type="checkbox" value="85" id="myId">
<input type="checkbox" value="95" id="myId">

when i'm get those values using js that will take only value 55 only. it is due to the same id="myId"

    var x = "";
     $("input[type='checkbox']").change(fucntion(){

     if(this.checked){

       x = x+","+x;

     }
    });

when run that will load only 55 values list like-: 55,55,55,55




Aucun commentaire:

Enregistrer un commentaire