当前位置: 首页 > 工具软件 > icheck > 使用案例 >

iCheck

柯乐童
2023-12-01

初始化

$(input).iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green"});

回调事件

iCheck提供了大量回调事件,都可以用来监听change事件。

事件名称使用时机
ifClicked用户点击了自定义的输入框或与其相关联的label
ifChanged输入框的 checked 或 disabled 状态改变了
ifChecked输入框的状态变为 checked
ifUncheckedchecked 状态被移除
ifDisabled输入框状态变为 disabled
ifEnableddisabled 状态被移除
ifCreated输入框被应用了iCheck样式
ifDestroyediCheck样式被移除

使用on()方法绑定事件:

$('input').on('ifChecked', function(event){
  alert(event.type + ' callback');
});

方法

下面这些方法可以用来通过编程方式改变输入框状态(可以使用任何选择器):

$('input').iCheck('check'); — 将输入框的状态设置为checked

$('input').iCheck('uncheck'); — 移除 checked 状态

$('input').iCheck('toggle'); — toggle checked state

$('input').iCheck('disable'); — 将输入框的状态设置为 disabled

$('input').iCheck('enable'); — 移除 disabled 状态

$('input').iCheck('update'); — apply input changes, which were done outside the plugin

$('input').iCheck('destroy'); — 移除iCheck样式

转载于:https://my.oschina.net/xkay/blog/863269

 类似资料:

相关阅读

相关文章

相关问答