【jquery】checkbox

jquery操作checkbox

模拟选中:

$('#aaa').prop('checked', true);

模拟取消选中:

$('#aaa').prop('checked', false);

其它的方法有些弊端,如:removeAttr('checked'),attr('checked', true);这样的没办法模拟反复选中取消,再选中再取消这样的交互方式。

 

获取某个checkbox的选中状态:$('#id').is(':checked')

选中返回true,未选中返回false

 

bootstrap的modal关闭事件:

$('#myModal').on('hide.bs.modal', function () {
 alert('嘿,我听说您喜欢模态框...');})
 }

form表单清空:

$('#form-id')[0].reset();

 

页面跳转方式,整理:https://www.jb51.net/article/46648.htm

posted on 2018-08-14 17:44  awildfish  阅读(147)  评论(0编辑  收藏  举报

导航