jarek-foksa/xel

jQuery check if checkbox is checked

matejmosko opened this issue · 3 comments

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.

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.

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

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