-1
$.colorbox({ href: previewLink, iframe: true, width: "90%", height: "90%" });
我使用上面的代碼來調用colorbox。一旦顯示顏色框,我想訪問和colorbox內的元素,然後更改css。colorbox內的訪問元素
但是我無法訪問colorbox中的元素。
我試過如下:
$(function() {
'use strict';
setInterval(
function() {
console.log("logging...");
var elements = document.getElementsByClassName("className");
if (elements.length > 0) {
console.log("Found element");
}
}, 1000);
});
假設您的瀏覽器支持'getElementsByClassName'(ie9 +),您可以在小提琴中複製嗎?沒有看到HTML被渲染,很難知道任何元素是否具有'className'類 – atmd