我有以下内容:
<iframe id="test">
<script>
variable='hi';
</script>
</iframe>
我需要知道如何通过 jquery 选择器从顶部窗口访问变量,如 $("#test").variable ?
最佳答案
你可以尝试:
$("#test")[0].contentWindow.variable;
关于jquery - 通过 jquery 选择器访问 iframe 中的变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6649024/