Why not select the previous item?

Good afternoon.
There is code:
<div id="buttons-tip-sdelki" class="btn-group btn-group-toggle">
 <label class="btn btn-primary waves-effect waves-themed">
 <input id="type-build" type="radio" name="tip-sdelki" value="rent"> rent
</label>
 <label class="btn btn-primary waves-effect waves-themed">
 <input id="type-build" type="radio" name="tip-sdelki" value="sell"> Sell
</label>
</div>

Get value of radio button like this:
var tipSdelki

 $('#buttons-tip-sdelki #type-build).on('click', function(){
$('#step3').removeClass('displayNone').addClass('displayActive');
 //change classes
 tipSdelki = ($(this).val()); // put the value into a variable
 });

In the end I want to access to rows (previous item) and add a class active
<label class="btn btn-primary waves-effect waves-themed">

Do this:
$(this).prev().css();
But in the end nothing comes out. Please tell me what I do wrong ?

I need to add the class active, by clicking on the radio button and to remove it if selected.
April 4th 20 at 13:00
1 answer
April 4th 20 at 13:02
Solution


PS id="type-build"
Do not use multiple ID, the identifier must 1

Find more questions by tags jQuery