Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
Determinar si el elemento iFrame existe como un elemento secundario dentro del contenedor

Con el siguiente fragmento:

 let iframe = videoWrapper; console.log(iframe);

Obtengo el siguiente retorno:
ingrese la descripción de la imagen aquí

Dentro video-player , tengo los siguientes elementos secundarios:
ingrese la descripción de la imagen aquí

¿Cuál es la mejor manera de determinar si <iframe> existe dentro de ese contenedor principal y verificar todos los niveles de elementos secundarios?

<iframe> puede tener uno o dos niveles dentro del elemento principal, por lo que todo depende.

Puntos de bonificación si puedo determinar si data-src existe dentro del iFrame.

Parece que no puedo rastrearlo en absoluto. He probado los siguientes elementos:

 let iframe = videoWrapper.parents().eq(2).find('iframe'); let iframe = videoWrapper.contents().find('iframe'); let iframe = videoWrapper.find('iframe'); let iframe = videoWrapper.find('iframe').length;

Nada parece haber funcionado, ¡toda ayuda será apreciada!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Espero entender bien lo que pides.

 // check if exists if ($('div.video-player iframe').length > 0) { alert('frame exists'); } // for finding child elements let iframeMain = $("div.video-player iframe").contents().find('#something deeper than iframe main tag'); // then just go deeper let iframe2ndLevelDeeper = $(iframeMain).contents().find('#something even more deeper inside iframe'); // check for data-src let dataSrc = $('').attr('data-src'); const $iframe = document.querySelector(`iframe`); $iframe.addEventListener("load", function () { if (dataSrc !== '') { console.log("loaded and exists"); } else {} });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!