我已經試過:
$(document).ready(function(){
$(parent.top).find('.IAgreeCheckBox:first').prop("checked", true);
});
無濟於事。
我已經試過:
$(document).ready(function(){
$(parent.top).find('.IAgreeCheckBox:first').prop("checked", true);
});
無濟於事。
$('.IAgreeCheckBox:first', window.parent.document).prop('checked', true);
只是'parent.document' ...'parent.top'等同於'top'。 –
它仍然不檢查父級複選框。有趣的是,當我提醒(parent.top.document).find('。IAgreeCheckBox:first')時,它會返回[object],這意味着它找到該元素,但它不檢查複選框 –
@Kant :那是因爲'parent.top.document'存在。 – Ryan
如果上下文的方法並不起作用,那就試試這個:
parent.$("#wOnlineApplication_cbxIAgree").prop("checked", true);
我就是這樣引用父元素的在iframe頁面內。
就像在這種情況下使用'context'參數 – locrizak
作爲一個側面說明,'window.parent === parent',所以除非'parent'變量已被映射,否則它可以直接使用。 –
它找到複選框,但是它不檢查它 –