In my html I have a button and a radio form where the inputs are created using a for loop.
<form id="form" class="mb-1">
{% for option in option_list %}
<input class="form-check-input text-primary" type="radio" name="option" value="{{option}}"> {{option}} <br>
{% endfor %}
</form>
<button type="button" class="btn btn-primary" id="btn">Button</button>
When the button is clicked, the radio inputs are either disabled or enabled based on some condition, which I have working fine, but when disabling an option, I also want to add a strike to the input to better show it's disabled. My js file has something like this.
$(document).ready(function() {
$('#btn').click(function() {
$('#form *').filter(':input').each(function(){
if (condition) {
$(this).prop('disabled', false)
}
else {
$(this).prop('disabled', true)
}
});
})
})
I've tried putting label tags around the inputs and using .wrap() and .css(("text-decoration", "line-through"), but it didn't work. They work on regular text fine, so I think I'm just not formatting the radio input labels correctly?