问题
I have some troubles with javascript. I would like to do an action after closing a popup window
<script type="text/javascript">
window.close()
window.opener.document.getElementById("login").modal('hide');
</script>
"window.opener.document.getElementById("login")" this part is recognize in the console, but not the modal function : "Uncaught TypeError: window.opener.document.getElementById(...).modal is not a function(…)"
I was thinking it's because jquery is not called before my code, so I added before juste in case :
<%= javascript_include_tag "application" %>
<script type="text/javascript">
window.opener.document.getElementById("login").modal('hide');
window.close();
</script>
but it's still not working. Can you see where is the problem ?
来源:https://stackoverflow.com/questions/36326929/action-after-window-close