I created a button element with an onclick using the following method:
domConstruct.create('button', {
...
value: someValue;
onclick: this.onBtnClick
}, someNode);The onBtnClick method uses the value of the button element, and also calls another function:
onBtnClick: function() {
var someVar = this.value;
this.someFunc();
},
someFunc: function() {
...
},When executing the onclick, it gives this error:
Uncaught TypeError: this.someFunc is not a function at HTMLButtonElement.onBtnClick
However, the button element's value could be correctly fetched by this.value. So it looks like in the onBtnClick method the this keyword only refers to the button element instead of the entire widget. Is there anyway to use both this.value and this.someFunc in onBtnClick?