答案 0 :(得分:0)
您的HTML可能就像
<label>
<input type="radio" name="option">
<span>
<i>ico</i> Option One
</span>
</label>
<label>
<input type="radio" name="option">
<span>
<i>ico</i> Option Two
</span>
</label>
<label>
<input type="radio" name="option">
<span>
<i>ico</i> Option Three
</span>
</label>
然后,您可以使用<span>
伪选择器以及相邻的选择器:checked
设置+
的样式,如下所示:
input + span { initial state }
input:checked + span { checked state }
答案 1 :(得分:0)
i made a script for you check below link:
https://jsfiddle.net/fatehjagdeo/uxd2ppj3/
it shows that li will active according to your click . please check it once
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js"></script>
<ul class="whitBigIcons clearfix">
<li class="">
<a href="#">
<i class="mesa-icon"></i>
<p class="mb0">Pagos, facturación y trámites administrativos</p>
</a>
</li>
<li class="">
<a href="#">
<i class="mesa-icon"></i>
<p class="mb0">Pagos, facturación y trámites administrativos</p>
</a>
</li>
<li class="">
<a href="#">
<i class="mesa-icon"></i>
<p class="mb0">Pagos, facturación y trámites administrativos</p>
</a>
</li>
<li class="">
<a href="#">
<i class="mesa-icon"></i>
<p class="mb0">Pagos, facturación y trámites administrativos</p>
</a>
</li>
</ul>
<script>
$(document).on('click','ul li',function(){
var obj=$(this);
$('ul li').each(function(){
$(this).removeClass('active');
});
obj.addClass('active');
});
</script>
<style>
.active{
background:#0099cc;
}
</style>