0

I'm trying to get all classes whose name is "titular_portada".

There are a lot, but for some reason is not working:

<!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);
    });
});

1 Answers1

1

Try this

$("iframe").each(function(index){
   console.log($(this).contents().find('.titulo_portada'));
});
Harshit Rastogi
  • 1,996
  • 1
  • 10
  • 19