Ok after some deeper research I found out that someone already had a similar issue.
Parts of javascript not working in issue navigator
Adding this made the trick:
JIRA.bind(JIRA.Events.ISSUE_REFRESHED, function() {
// your code
});
Thank you @daz , you helped a lot!