一、html代码:
<div class="ques-tc-r" id="question_type"> <ul class="clearfix"> <li class="select-cur"> <input type="radio" value="1" name="question_type" checked="checked" /> <span>问题a</span> </li> <li> <input type="radio" value="2" name="question_type" /> <span>问题b</span> </li> <li> <input type="radio" value="3" name="question_type" /> <span>问题c</span> </li> <li> <input type="radio" value="4" name="question_type" /> <span>问题d</span> </li> </ul> </div>
二、jquery代码:
$('.ques-tc-r ul li').each(function (i, o) { $(o).click(function () { $(o).addclass('select-cur'); $(o).siblings().removeclass('select-cur'); $('.select-cur > input').attr('checked', true) $('.ques-tc-r ul li:not(.select-cur) > input').each(function (index, it) { $(it).attr("checked", false) }) }) });
如对本文有疑问, 点击进行留言回复!!
网友评论