-2

My HTML is like this

    <div class="col-md-12 money-radio-container">
  <input type="radio" name="optradio" class="money-radio" value="10">10 <span>$</span>
  <input type="radio" name="optradio" class="money-radio" value="20">20 <span>$</span>
  <input type="radio" name="optradio" class="money-radio" value="50">50 <span>$</span>
</div>

Now I want to give red color to which ever radio button is selected. How can I achieve this through CSS?

Note: As you may have noticed When i click on each radio button no html change happens. So i don't know how to identify selected one. Fiddle: https://jsfiddle.net/rrmzvkag/3/

None
  • 5,582
  • 21
  • 85
  • 170

1 Answers1

2

The CSS rule would be

input[type="radio"]:checked

Unsure what exactly what you want to do but if you were planning on doing some styling on the element which goes after each radio element in your question you'd use the following rule

input[type="radio"]:checked + span
Lee Brindley
  • 6,242
  • 5
  • 41
  • 62