lundi 11 mars 2019

how to checked a checkbox is checked or not checked with jquery ajax

hi iam try to checked a checkbox when user clicking on checkbox and when is checked add attribute checked and when is not checked remove attribute checked and when is checked set value="on" and when is not checked set attribute value="off" and passing result to php code for save in db iam writing a code bot not working

$(document).ready(function () {

          function checking() {

                     var checkbox=$('.checkbox');
                     var check = $(checkbox).is('checked',true );
                     if (check){
                        // $(checkbox).removeAttr('checked',true);
                         $(checkbox).prop('checked',true);
                     } else {
                       //  $(checkbox).attr('checked',false);

                         $(checkbox).prop('checked',false);

                     }
                 }



             });




Aucun commentaire:

Enregistrer un commentaire