代码如下<style>label{display:block;width:12px;height:12px;} .che{background:url('/public/Admin/images/h1.png') no-repeat;width:12px;height:12px;cursor: pointer;} .che:hover{background:url('/public/Admin/images/h2.png') no-repeat;width:12px;height:12px;cursor: pointer;} .selected{background:url('/public/Admin/images/h3.png') no-repeat;width:12px;height:12px;cursor: pointer;} .bgq{background-color:pink;width:20px;height:10px;} </style><script> for (i in $('label')){ $('label')[i].onclick=function(e){ console.log($('label').length); for(j in $('label')){ $('label')[j].attr("class", "che"); } $(this).removeClass('che'); } } </script><form><tr id="typea"> <th>(1)</th> <td><input type="radio" name="question1" value="1"/><label class="che" ></label></td> <td><input type="radio" name="question1" value="2"/><label class="che" ></label></td> <td><input type="radio" name="question1" value="3"/><label class="che" ></label></td> <td><input type="radio" name="question1" value="4"/><label class="che" ></label></td> <td><input type="radio" name="question1" value="5"/><label class="che" ></label></td> </tr> <tr id="typeb"> <th>(2)</th> <td><input type="radio" name="question2" value="1"/><label class="che" )></label></td> <td><input type="radio" name="question2" value="2"/><label class="che" ></label></td> <td><input type="radio" name="question2" value="3"/><label class="che" ></label></td> <td><input type="radio" name="question2" value="4"/><label class="che" ></label></td> <td><input type="radio" name="question2" value="5"/><label class="che" ></label></td> </tr>请问jQuery的部分哪里错了。
添加回答
举报
0/150
提交
取消