简体   繁体   English

在页面上将文本插入iFrame(从iframe外部复制)

[英]Inserting text into iFrame on page (copy from outside the iframe)

I am trying to pre-fill a form field with a string of text that is on the page. 我正在尝试使用页面上的文本字符串预填充表单域。 But the form is in an Iframe which is making it difficult. 但是该表格位于iframe中,因此很难。

Here is the page in question however you will not get much out of the link as the dynamic content for you will be empty. 这是有问题的页面,但是您不会从链接中得到太多帮助,因为您的动态内容将为空。 This screenshot might explain better: http://prntscr.com/kbqoak 此屏幕截图可能会更好地说明: http : //prntscr.com/kbqoak

I tried to put together a Javascript to copy that text over into that form field: 我试图编写一个Javascript将文本复制到该表单字段中:

$(document).ready(function() {
jQuery(".refer_webinar input").val($('.webinartitle').text());
)
    }

It would grab the text from the "webinartitle" class and insert into form field ( http://prntscr.com/kbqqp4 ). 它将从“ webinartitle”类中获取文本,然后插入到表单字段( http://prntscr.com/kbqqp4 )中。 But it does not work and I suspect because it is in an iframe. 但是它不起作用,我怀疑是因为它在iframe中。

Can you please help figuring out if there is a way to inject this information in there? 您能帮忙弄清楚是否有办法在其中注入这些信息吗? (if it's possible) (如果它是可能的)

If in the iframe you can do so ... 如果在iframe中,您可以这样做...

$(function(){
    $('iframe').contents().find('.refer_webinar input').val($('.webinartitle').text());
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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