I am trying to bind values to a function in a loop. How can I access the binded values in the function?
// ansswer number is is different each time
btn.find("a").data(this.key, option.slide).bind("click", this._continueOnClick.bind(answerNumber));
Now from the function _continueOnClick, how can I actually access the value of answerNumber?
The function:
_continueOnClick: function (e) {
console.log(answerNumber); //fails
}
console.log(e)??bindcan be used. The first argument passed tobindwill be found inthis.<span>option text</span>console.log(this)has to work. If not then the code you show and the one you actually have do not match.