jarek-foksa / xel

Xel - Widget toolkit for building native-like Electron and Web apps
https://xel-toolkit.org
Other
682 stars 59 forks source link

jQuery check if checkbox is checked #34

Closed matejmosko closed 3 years ago

matejmosko commented 6 years ago

Hello, I am stuck on a problem with your x-checkbox. I have tried all of the following methods to check if checkbox is checked but with no success. Does x-checkbox act like a checkbox?

$('#checkbox').is(":checked") $('#checkbox').prop('checked') $('#checkbox')[0].checked $('#checkbox').get(0).checked

When I replace your x-checkbox with normal input type='checkbox' these methods work as expected.

jarek-foksa commented 6 years ago

You should use toggled property/attribute, not checked. I didn't follow the HTML API naming conventions here because I wanted it to be consistent with related <x-button>, <x-switch> and <x-radio> elements.

matejmosko commented 6 years ago

Thank you. It would be great to create a HTML API fallback. Or at least mention this incompatibility at xel-toolkit.org.

jarek-foksa commented 3 years ago

The new project website now documents the JavaScript API for each element.