如何检查页面载入时是否选中该复选框,如果检查过,则将该类设置为活动?jQuery检查是否:在加载时检查
<label class="volume" for="mChatUseSound">click</label>
<input type="checkbox" id="mChatUseSound" />
$('.volume').click(function(){
$(this).toggleClass('active');
});
.active{
background:#FF0000;
}
尝试'$(文件)。就绪();' http://api.jquery.com/ready/ – Tro