I cannot be sure of what I will say without testing it, but perhaps this can help. Last week, I worked with Bootstrap, and I had problems with modal when I tried to clean them in certain cases.
The fact is that in some situations Bootstrap again created a modal form as a direct child of the body. So when I called an empty function, it pointed somewhere else.
My suggestion is to evaluate alert($('#leavebalstatus').length) as @AlenaKastsiukavets says in the comments, but changing the identifier of leftbalstatus in the class so that jQuery has no problem choosing more than one object.
Finally, I solved this by putting the modal as a direct child of the body, but obviously, it is likely that the solution you need can change a little.
source share