And I wrote to you about the very real use case of checking the value outside of the element’s click event and how it can fail.
Can you name another JQWidget that will catastrophically fail if JQX commands are run before user interaction? (Because that’s not the very *best* of paradigms.)
Default mode handles this use case by returning undefined:
RadioButton Mode handles this use case by returning an empty array:
Checkbox Mode has a fatal error, which I (as a user of this library) cannot test or account for without modification of your library code.
Leaving aside the completely inconsistent manner of return types (Sometimes it’s an int, sometimes an array, sometimes a string), calling a method on a variable that could be null without handling that case is just bad programming. Now, if you have a git repo I would gladly fork it, add the two lines of code to handle a null value, and send you a pull request.
Otherwise:
Which, I think, is a decent solution. Not only does it not error, it consolidates expected return types. This makes it easier for those of us using your library. Honestly, I would prefer that this control always return an array, but the posted solution above is literally the least amount of effort required to fix this error.