Probably want to wrap this in a setTimeout(0) to ensure JS has time to register for the event.