簡體   English   中英

如何在iframe的$ {document).ready中選中父框架中的復選框?

[英]How do I check a checkbox in the parent frame from within an iframe's $(document).ready?

我試過了:

$(document).ready(function(){
    $(parent.top).find('.IAgreeCheckBox:first').prop("checked", true);  
});

無濟於事。

$('.IAgreeCheckBox:first', window.parent.document).prop('checked', true);

您將需要document對象,而不是window

$(parent.document).find('.IAgreeCheckBox:first')

這是一個演示。

如果上下文方法不起作用,請嘗試以下操作:

parent.$("#wOnlineApplication_cbxIAgree").prop("checked", true);

這就是我在iframe頁面中時引用父元素的方式。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM