Hello!
I'm building a plugin for CKEditor and have added a checkbox element to a dialog:
How can I determine the "checked" state of the checkbox?
Looking over the API docs, there doesn't seem to be an "isChecked()" method, and CKEDITOR.dom.element#getValue() always returns "on" regardless of checked state. I also tried CKEDITOR.dom.element#getAttribute('checked') but that always returns null.
The only workaround I have found is to use vanilla javascript to test the "checked" property directly, but I'm afraid this might not be compatible with all browsers (ahem... IE).
Thanks!
I'm building a plugin for CKEditor and have added a checkbox element to a dialog:
CKEDITOR.dialog.add('myplugin', function(editor) { return { title: 'My Plugin', elements: [ { type: 'checkbox', label: 'click me', onClick: function(event) { // triggered when checkbox is clicked var checkbox = event.sender; console.log('clicked!', checkbox.getValue()); } } ] }; });
How can I determine the "checked" state of the checkbox?
Looking over the API docs, there doesn't seem to be an "isChecked()" method, and CKEDITOR.dom.element#getValue() always returns "on" regardless of checked state. I also tried CKEDITOR.dom.element#getAttribute('checked') but that always returns null.
The only workaround I have found is to use vanilla javascript to test the "checked" property directly, but I'm afraid this might not be compatible with all browsers (ahem... IE).
Thanks!