Browse Source

Move checkbox setup into method

pull/2034/head
jlukic 9 years ago
parent
commit
651c65a025
1 changed files with 18 additions and 12 deletions
  1. 30
      src/definitions/modules/checkbox.js

30
src/definitions/modules/checkbox.js

@ -59,18 +59,7 @@ $.fn.checkbox = function(parameters) {
module.create.label();
module.add.events();
if( module.is.checked() ) {
module.set.checked();
if(settings.fireOnInit) {
settings.onChecked.call($input.get());
}
}
else {
module.remove.checked();
if(settings.fireOnInit) {
settings.onUnchecked.call($input.get());
}
}
module.setup();
module.observeChanges();
module.instantiate();
@ -92,6 +81,23 @@ $.fn.checkbox = function(parameters) {
;
},
setup: function() {
if( module.is.checked() ) {
module.debug('Setting initial value to checked');
module.set.checked();
if(settings.fireOnInit) {
settings.onChecked.call($input.get());
}
}
else {
module.debug('Setting initial value to unchecked');
module.remove.checked();
if(settings.fireOnInit) {
settings.onUnchecked.call($input.get());
}
}
},
refresh: function() {
$label = $module.find(selector.label);
$input = $module.find(selector.input);

Loading…
Cancel
Save