Radio Button and display NONE when clicked

  1. I have radio group buttons but when I click on chosen radio button it should show a style without value:

I try to add a rectangular box when the radio button is clicked.
but when I click on another radio button remove style display: NONE.

style="display: none;" 

How to manage JavaScript in the correct element status?

Radio buttons as an example:

<div class="content">
    <legend>Please choose your favourite snack:</legend>
    <div class="radio-wrapper">
      <input id="cookie" type="radio" name="snack" value="cookie"/>
      <label for="cookie">Cookies 🍪</label><br>
    <div class="radio-wrapper">
      <input id="apple" type="radio" name="snack" value="apple">
      <label for="apple">Apple 🍏</label><br>
    <div class="radio-wrapper">
      <input id="pretzels" type="radio" name="snack" value="pretzels">
      <label for="pretzels">Pretzels 🥨</label>

Suggestion: Don’t use Javascript. Especially because what you’re trying to mess with is a CSS class.

input[type="radio"]:checked + label:after,
input[type="radio"]:checked + label:before {
  position: fixed;
  opacity: 0;
  pointer-events: none;

Thank you for the message.
I tried to fix this but there is already code and it will collapse: &::after {

Can you post the whole code to test this option? CodePen…or…

Take that block. Stick it at the very end of your CSS. Annnnd done.

I have solved using checkbox and Bootstrap V3 feature. But how to solve using radio button?

<meta http-equiv="content-type" content="text/html" />

<title>Checkbox button and payment method</title>


<div class="form-group">
<div class=""><input data-toggle="collapse"  aria-expanded="false" data-target="#accordion" type="checkbox" name="payment_method" />Credit card payment method</div>

<div id="accordion" class="collapse" style="" data-modul="payment_method">

<div class="">

<div class="form-group">


<label>Credit card</label>
<input type="text" name="creditcard" value="" class="" style="" />



<label>Credit card options</label>
<input type="text" name="creditcardoptions" value="" class=" form-control" style="" />


</div></div></div><!-- .accordion -->