-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckbox.html
38 lines (33 loc) · 1.19 KB
/
checkbox.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<script>
(function (root, factory) {
root.Elliptical.Behaviors=root.Elliptical.Behaviors || {};
root.Elliptical.Behaviors.Checkbox=factory();
}(this, function () {
return {
__events:function(){
var self=this;
this._event(this.element,'change','input',function(event){
self._resetSemanticState();
self._onChange(event);
});
},
_onChange:function(event){
var eventType=this.event;
var element=$(event.currentTarget);
var checked=element.is(':checked');
var data={
value:element.val(),
checked:checked,
id:element.attr('id'),
name:element.attr('name')
};
this.element.trigger(eventType,data);
(checked) ? this.element.attr('checked','') : this.element.removeAttr('checked');
},
isChecked:function(){
var input=this.element.find('input');
return input.is(':checked');
}
};
}));
</script>