引导程序复选框和无线电输入,带有字体可观



任何人都可以在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上都无法工作。这里怎么了?小提琴:

ty。

只需在每条JavaScript行之后添加一个分号即可。我认为当您不使用;

结束JavaScript语句时,IE8 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);
});

小提琴

最新更新