I'm trying to deal with a checkbox checked event on my Magento project, here is my html code for the checkbox:
<td class="col col-method">
<input type="checkbox" data-bind="checked: checkedAction, click: clickedAction"/>
</td>
And below is the js code:
define([
'jquery',
'underscore',
'Magento_Ui/js/form/form',
'ko'
], function ($, _, Component, ko) {
'use strict';
return Component.extend({
defaults: {
template: 'Vendor_Module/checkout/shipping/template'
},
initialize: function() {
var self = this;
this._super();
this.setCheckbox();
},
setCheckbox: function() {
var viewModel= {
selectedAction: ko.observable(false),
clickedAction: function() {
window.alert('checkbox checked!!');
return true;
}
};
ko.applyBindings(viewModel);
}
});
});
It didn't work unluckily, could you point out what is wrong here?