radio选中状态对应⽂字改变颜⾊
效果:
html:
<input type="radio" class="radio" name="apply" value="" checked="checked" />
<lable class="radio-font" for="apply">本⼈申请</lable>
<input type="radio" class="radio" name="apply" value="" />
<label class="radio-font" for="apply">代替他⼈申请</label>
css:
.radio {
width: 18px;
height: 18px;css特效文字
border: 2px solid #649723;
margin-top: 20px;
}
.radio-font {
font-size: 18px;
margin-right: 25px;
color:#767676;
margin-top: 20px;
}
js:
$(document).ready(function (){
$("input[type='radio']").first().next().css('color','#649723');  //设置默认选项的⽂字为选中状态
$(":radio").click(function (){
$("input[type='radio']").each(function(){
if(this.checked){
$(this).next().css('color','#649723');
}else{
$(this).next().css('color','#767676');
}
});
});
});

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。