tdreyno/iphone-style-checkboxes — Issue #52: Error handling arguments in jQuery
Author: rickyah
Created: 2011-12-22 23:15:29+00:00
State: open

In the jQuery code the extend function is used to provide a set of default options when creating the ios styled checkbox. There is a bug in that code, as default options always override the user options:

iphone-style-checkboxes.js:271

```javascript
opts = $.extend({}, options, {
resizeHandle: false,
disabledClass: 'iOSCheckDisabled',
containerClass: 'iOSCheckContainer',
labelOnClass: 'iOSCheckLabelOn',
labelOffClass: 'iOSCheckLabelOff',
handleClass: 'iOSCheckHandle',
handleCenterClass: 'iOSCheckHandleCenter',
handleRightClass: 'iOSCheckHandleRight',
dataName: 'iOSCheckbox'
});
```

Should be
```javascript
opts = $.extend({}, {
resizeHandle: false,
disabledClass: 'iOSCheckDisabled',
containerClass: 'iOSCheckContainer',
labelOnClass: 'iOSCheckLabelOn',
labelOffClass: 'iOSCheckLabelOff',
handleClass: 'iOSCheckHandle',
handleCenterClass: 'iOSCheckHandleCenter',
handleRightClass: 'iOSCheckHandleRight',
dataName: 'iOSCheckbox'
}, options);
```

The options variable containing the user defined options should be placed AFTER the object with the default options.