I want to have a jquery ui widget option be a string by default, but I want it to be able to overridden by an object. When I do this, I actually get the string converted to an object in some strange way, and then extended with whatever object I pass in.
$.widget("ui.test", {
options: {
anOption: "a,b,c"
},
_create: function() {
console.log(this.options);
}
});
$('div').test({
anOption: {
a: 'A'
}
});
If I skip passing in the option to the widget, it will be received as a string in the _create method. If I pass in an object, the strange behavior occurrs. In chromes js console log I get this, which is not what I want.
Object
anOption: Object
0: "a"
1: ","
2: "b"
3: ","
4: "c"
a: "A"
How do I solve this?
jsfiddle: http://jsfiddle.net/MatteS75/s9wK2/