当您选择一个单选框时,我正在尝试绑定一个边框图像。这是代码:
<table width="100%">
<tr>
<td><img src="img/option/collar.png" width="100px" id="option_img"><br><input class="optionVent" type="radio" name="vent" value="1">vent</td>
<td></td>
<td><img src="img/option/collar.png" width="100px" id="option_img"><br><input class="optionVent" type="radio" name="vent" value="1">vent</td>
</tr></table>
这是javascript:
$(".optionVent").click(function(){
if($(this).is(':checked')){
$("#option_img").css('border', "solid 1px orange");
}
});
As it stands now, when 1 box is selected, both images get borders. 我想不出一种将图像绑定到单选框的方法。
谢谢,