html code
<label class="radio-label1"><span>   원 룸</span>
<form:radiobutton onclick="test()" class="type-btn" path="market_type" value="1"/>
</label>
<label class="radio-label2"><span>   투 룸</span>
<form:radiobutton onclick="test()" class="type-btn" path="market_type" value="2"/>
</label>
<label class="radio-label3"><span style="padding-left:15px"> 쓰리룸</span>
<form:radiobutton onclick="test()" class="type-btn" path="market_type" value="3"/>
</label>
<label class="radio-label4"><span style="padding-left:3px">오피스텔</span>
<form:radiobutton onclick="test()" class="type-btn" path="market_type" value="4"/>
</label>
<label class="radio-label5"><span style="margin-left:15px"> 아파트</span>
<form:radiobutton onclick="test()" class="type-btn" path="market_type" value="5"/>
</label>
jquery code
function test() {
var obj_value = $("input:radio[name='market_type']:checked").val();
$('.radio-label'+obj_value).css('background-color','red');
}
css code
.third-radio label{
width:110px;
height:40px;
padding-top:10px;
margin-left:15px;
text-align:center;
border: 1px solid #d3d3d3;
font-size:20px;
}
.type-btn{
opacity:0;
}
I want to restore the color of the unchecked radio button The label remains red even when the check is released.