Javascript not wait file dialog closing
<p>My problem is javascript not wait for file selection dialog closing.
I have just found an solution that we declare a onChange event for  element. So onChange event work right, but script still run before onChange event. They a asynchronous.
I think may be there is a way to check if there is any dialog opening ?
Please help me, 2 day of mine :)</p>