I am trying to replace my radio circles by div's.
The selecting by clicking on the divs works. The highlighting of the selected div works.
But how can i remove the "selected" class of the other childeren in the same parent when i select one of the other options?
My JS is now:
$('.option').click(function() {
$('input', this).prop("checked", true);
$(this).addClass('optionSelected');
}
Use siblings()
to target the sibling div's,
$('.option').click(function() {
$('input', this).prop("checked", true);
$(this).addClass('optionSelected')
.siblings()
.removeClass('optionSelected');
});