jeudi 1 septembre 2016

retrieving value of checkbox in react.js

I am quite new to react.js and i want to retrieve value of my checkbox, when it is checked. ... can somebody guide me how to retrieve value of checkbox, when it is checked.

I am using this "http://ift.tt/2bEi2Si". my code looks like this.

          <div className="user_box">
                    {
                        check.map((values , i)=>{


                            return   <Checkbox
                                name = "checkbox"
                            onChange={this.checkvalue.bind(this)}
                            value={values.username}
                            />

                        })
                    }
                        </div>

my function

      checkvalue(e){

         //var all_users = [];
         //var value = this.checkbox.value;
        //all_users.push(value);
       //console.log(all_users);

       console.log('checkbox checked:', (e.target.checked));

   }

still not getting how to retrieve value of it...

please guide me, if you guys some better idea also. thanks




Aucun commentaire:

Enregistrer un commentaire