In order to obtain the standard styling of the Lightning Design System, I've used in one of my components the following HTML to render a simple checkbox, that can be found in the standard docs too:
<div class="slds-form-element">
<div class="slds-form-element__control">
<span class="slds-checkbox">
<input type="checkbox" name="options" value="options" id="checkbox-1">
<label class="slds-checkbox__label" for="checkbox-1">
<span class="slds-checkbox_faux"></span>
<span class="slds-form-element__label">Checkbox Label</span>
</label>
</span>
What I want to do is to be able to memorise the value of the checkbox, after each check. I've tried to attach in an onselect, onchange, and onclick event, an action from the controller, but I see that the action doesn't get called. Is there any thing that I'm missing?
EDIT: After @Sfdcfox suggestion, I am adding a simple controller that holds a simple method, which I want to bind with the onselect event of the input checkbox(preferably):
Controller.js:
{
onCheck: function(cmp, evt, helper) {
console.log("Checkbox Checked!");
}
}
As pointed out before, I would like to use this function in the form of:
...
<input type="checkbox" name="options" value="options" onchange="{!c.onCheck}" id="checkbox-1">
...