简体   繁体   中英

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.

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

I tried to put together a Javascript to copy that text over into that form field:

$(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 ). But it does not work and I suspect because it is in an 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 ...

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

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