任何人都可以在 IE8 上给我解决这个问题的方法吗?我有这个: HTML:
<label>
<input type="checkbox" checked /><i class="icon-fixed-width icon-check"></i> Three
</label>
CSS:
[type=checkbox] { display: none; }
label { cursor: pointer; }
[class*=icon-].icon-fixed-width { text-align: left; }
jQuery:
$("[type=checkbox]").change(function () {
$checkbox = $(this)
$icon = $checkbox.siblings("[class*=icon-]")
checked = $checkbox.is(":checked")
$icon.toggleClass('icon-check', checked)
.toggleClass('icon-check-empty', !checked)
});
在现代浏览器上一切正常,但在 IE8 上无法正常工作。 这里有什么问题? <强> Fiddle:
很重要。
最佳答案
只需在每个 Javascript 行后添加一个分号。我认为当您不以 ;
$("[type=checkbox]").change(function () {
$checkbox = $(this);
$icon = $checkbox.siblings("[class*=icon-]");
checked = $checkbox.is(":checked");
$icon.toggleClass('icon-check', checked).toggleClass('icon-check-empty', !checked);
});
关于javascript - Bootstrap checkbox 和 radio input with font-awesome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21551732/