代码如下:
问题:当我点击li的时候给里面的input一个checked值,让他呈现选中状态,但是当我点了其他的li再回来点击时却怎么也选不中了,但是checked值是有的。
<div class = "bank_wrap ">
<ul>
<li><input type="radio" name = "pay"><div><img src = "images/zhifubao.png"></div></li>
<li><input type="radio" name = "pay"><div><img src = "images/scanner_pay.png"></div></li>
<li><input type="radio" name = "pay"><div><img src = "images/caifutong.png"></div></li>
<li><input type="radio" name = "pay"><div><img src = "images/weixinzhifu.png"></div></li>
<li><input type="radio" name = "pay"><div><img src = "images/zaixianzhifu.png"></div></li>
<div style = "clear:both;"></div>
</ul>
</div>
<script type = "text/javascript">
function click_bank (){
$(".bank_wrap").find("li").click(function(){
$(this).find("input").attr("checked",true)
});
}
click_bank();
</script>
别用attr,用prop