Discuss / JavaScript / 作业

作业

Topic source

// TODO:绑定事件

// 全选(全不选)点击事件 selectAll.change(()=>{ var all = selectAll.prop('checked') langs.prop('checked', all) updateStaus() })

// 反选点击事件 invertSelect.click(()=>{ langs.each(function(){ $(this).prop('checked', !($(this).prop('checked'))) }) updateStaus() })

// 语言点击事件 langs.change(()=>{ updateStaus() })

// 状态更新函数 function updateStaus(){ var all = form.find('[name=lang]:checked').length === langs.length selectAll.prop('checked', all) if(all){ selectAllLabel.hide() deselectAllLabel.show() }else{ selectAllLabel.show() deselectAllLabel.hide() } }


  • 1

Reply