Jira bind is not triggering

We are in process of moving our plugin from Jira version 8.20.14 to 9.4.11.
in our plugin code, we need to call a function when a issue is updated. we are using the following binding, but it is not triggering when a update is made to the issue.

AJS.$(document).ready(function() {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context, reason) {

Any help is much appreciated.

I’d try using AJS.toInit instead:

AJS.toInit(function () {
  JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context, reason) {

Hi ,
I have wrapped it with AJS.$(document).ready(function(){})
Would this not work?


Not necessarily: the fact that the document is ready doesn’t imply that all the bootstrapping by Jira is done: it just means that the DOM is safe to be manipulated and JS can reliably start being executed, but doesn’t guarantee anything about the order of execution

@PaoloCampanelli once I update the document ready into AJS.toInit, it worked. thanks