简体   繁体   中英

how to grab a fields data from inside an iframe?

I am trying to pull data from inside an iframe that links to http://www.w3schools.com/ . I keep getting errors that won't allow me to pull out the data of any field or grab the entire page's html and put it into a variable.

I have already tried:

$('iframe').html();

I have also tried not loading it in an iframe so it could be accessed easier, but that also didn't work.

 $(function(){
          $("#includedContent").load("http://www.w3schools.com"); 
        });

要从iframe主体获取内容,您应该使用:

$("iframe").contents().find('body').html();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM