0
我想读取一个用户名是外侧iframe。如何在单击iframe内的按钮时获取父级值的iframe?jquery从iframe读取父值
<span id="user">
My Name
</span>
<iframe id="my-iframe" height=200 width=300>
<input type="button" id="myButton" value="click">
</iframe>
$('#myButton').click(function(){
var userName = $('#user').text();
alert(userName);
});