0

I have a Django form field that is prefilled and using widget gave it a class. The form is rendered out in html as

<div id="id_clothingType" class="closet-form-section form-clothing-type">
    <div>
        <label for="id_clothingType_0">
            <input type="radio" name="clothingType" value="11" class="closet-form-section form-clothing-type" required="" id="id_clothingType_0">
            Accessory
        </label>
    </div>
    <div>
        <label for="id_clothingType_1">
            <input type="radio" name="clothingType" value="12" class="closet-form-section form-clothing-type" required="" id="id_clothingType_1" checked>
            Top
        </label>
    </div>
</div>

How do I style the radio inputs as buttons such that it changes its background color when it is checked without changing the html (form template)?

The problem is that the input is within the labels, so I am unable use the conventional way of the input:checked + label to style them.

Jo T.
  • 1
  • 1

0 Answers0