html - How to display the checkbox value on same page without submit button and form in php? -




i have checkbox , if user selects check box value of checkbox display on same page without refresh page.

index.php

<input  type="checkbox" value="<?php echo $value;?>" name="value_r" id="value_r"/>  if(!isset($_post['value_r'])) echo $_post['value_r']; } 

if ajax can 1 know how display value ajax?

$("#value_r").change(function () {     var ischecked = $(this).is(":checked") ? 1:0;         $.ajax({         type: "post",         url: "index.php",         async: true,         data: { ischecked: ischecked },         success: function (response) {         }     });   }); 

instead of using ajax or javascript can using css. check updated snippet below..

input[type=checkbox] + label{      display: none;  }  input[type=checkbox]:checked + label{      display: inline-block;  }
<input  type="checkbox" value="<?php echo $value;?>" name="value_r" id="value_r"/><label for="">checkbox value comes here</label>





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -