Debug javascript error in modal window