【问题标题】:My jquery don't take classes of this iframe? [duplicate]我的 jquery 不参加这个 iframe 的课程? [复制]
【发布时间】:2023-03-10 08:06:01
【问题描述】:

我正在尝试获取名称为“titular_portada”的所有课程。

有很多,但由于某种原因不起作用:

<!DOCTYPE html>
<html lang="es">
<head>
    <link rel="stylesheet" href="css/styles.css">
</head>
<body>
    <iframe src="https://vandal.elespanol.com" id="iframe" width="100%" height="100%"></iframe>
    <script src="js/jquery-3.6.0.js"></script>
</body>
</html>
$(window).on("load", function() {
    $("#iframe > .titulo_portada").each((i, el) => {
        console.log(el);
    });
});

【问题讨论】:

    标签: html jquery iframe


    【解决方案1】:

    试试这个

    $("iframe").each(function(index){
       console.log($(this).contents().find('.titulo_portada'));
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-05
      • 1970-01-01
      • 1970-01-01
      • 2013-06-13
      • 2014-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多