我想將一個單擊事件添加到嵌套在iframe
的iframe
之內的元素之一。將`click`事件添加到iframe的`iframe`的子節點 - 不要撥打
這是一個IFRAME .ssueContentIframe
下這個,還有另外一個iframe
添加爲#SmartReportTabContent1
所以裏面的第二IFRAME元素的,我嘗試添加像這樣的單擊事件:
基本上,我不知道什麼時候兩者iframe
將被加載,所有元素將可用,爲今後我加入:
$('.ssueContentIframe').contents().find('#SmartReportTabContent1').find('.ui-grid-selection-row-header-buttons.ui-grid-icon-ok.ui-grid-row-selected').on('click', function(){
alert('Hi');
});
但不工作。 iframe
是否存在,並且將點擊事件添加到此處的某個元素中的正確方法是什麼?
在此先感謝!
我可以在'onDocumentReady'中使用這個嗎?第一個iframe類名稱是'ssueContentIframe',裏面我獲得第二個iframe作爲'#SmartReportTabContent1' – 3gwebtrain
所以只需使用SmartReportTabContent1作爲你的iframe容器 – Stormhashe
我試過像這樣:'$(document).ready(function(){ $ ('#SmartReportTabContent1').ready(function(){ console.log('我準備好了'); }); });'但是就緒函數本身我得到了安慰。 (當時這裏根本就沒有iframe) – 3gwebtrain