Meteor --production mode doesn't execute jQuery code

When I run meteor --production , some of the jQuery code does not execute (it works perfectly without using --production )

The code is the following:

Meteor.startup(function() {
   	$('#allModals div.gameModal').on('hide.bs.modal', function() {
             console.log(this);
	})
});

Basically it selects all bootstrap modals when they are closed and logs the content of each modal.
I’d really appreciate if someone can suggest me an idea to fix it.
Thanks.

I would probably use that modals template onRendered instead of Meteor.startup
if Meteor cant catch these events as any other click etc…

But I’m using the React. Any idea how I would implement it using React?

ComponentDidMount ? or something like that

No luck.
I implemented it using componentDidMount as you suggested, and it still doesn’t work when I use meteor --production. It works perfectly without using --production though…
Any other idea why this is happening?