复选框默认选中无效! 我试图修复它,但我找不到这里的错误在哪里? 所以在检查的页面加载上,在未检查的页面加载之后!? 我试过了
<div class="onoffswitch" style="margin: 0 auto;">
<input type="checkbox" class="avacheckbox onoffswitch-checkbox" id="AvButtonAutoGames" checked="checked"/>
<label class="onoffswitch-label" for="AvButtonAutoGames">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
还有那个
<div class="onoffswitch" style="margin: 0 auto;">
<input type="checkbox" class="avacheckbox onoffswitch-checkbox" id="AvButtonAutoGames" checked/>
<label class="onoffswitch-label" for="AvButtonAutoGames">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
最佳答案
要指定值,请使用checked="true",否则不要指定该属性。
Checked: <input type="checkbox" checked="true" /><br/>
Not checked: <input type="checkbox" />
关于javascript - 复选框默认选中 ="checked"不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53622539/