我有这样的单选按钮:选择CSS3:不被查在IE8中工作(使用ie7.js)
<input class="check" type="radio" id="radio1" name="group"/>
<label for="radio1">vrai</label>
<input class="check" type="radio" id="radio2" name="group"/>
<label for="radio2">faux</label>
<input class="check" type="radio" id="radio3" name="group"/>
<label for="radio3">75</label>
<input class="check" type="radio" id="radio4" name="group"/>
<label for="radio4">18</label>
我所选择的类时是:checked
,但奇怪的是,即使使用ie7.js它不在ie8中工作。
这里是我的JS:
$(document).ready(function() {
$('input:checked').addClass("selected");
$('input').click(function() {
$('input:not(:checked)').removeClass("selected");
$(this).addClass("selected");
});
});
你应该尝试使用onchange事件而不是 –
我应该在哪里使用onchange? – lchabrand
使用'ie7.js',':checked'选择器应该在IE7/8中正常工作,[甚至还有一个测试用例](http://ie7-js.googlecode.com/svn/test/checked.html )类似于你正在做的事情。 –