使用jQuery获取父页面元素及子页面元素的方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/laizhixue/article/details/84871343

背景: 

子页面元素是include进来的,在子页面元素需要获取父页面的元素做一些操作.. 


jquery提供了一个很好的方法 :
$("#父页面元素id" , parent.document)  
同样适用于iframe 
例子:

$("#id",parent.document).val("0");

猜你喜欢

转载自blog.csdn.net/laizhixue/article/details/84871343