I know this same question has been asked many times before, but no solution worked for me. And I already have spent many hours on it.
In my case I am simply replacing a text with with an html element and on onclick event I want to call an event or a function defined in the same class.
var linkToReplace = '<a onclick="this.events.publish(\'issue:display\')">'+issueKey+'</a>';
Error is given below:
Uncaught TypeError: Cannot read property 'publish' of undefined.
it works for
"alert(\'hello\')", but all other functions got undefined.
Thanks in advance!