如何在iframe表单元素内附加html [英] How to append html inside iframe form element

查看:98
本文介绍了如何在iframe表单元素内附加html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我的iframe具有以下结构

If i have an iframe that has the following structure

<iframe id="iframesitefileupload" src="IframeTest.aspx" style="margin-left:20px" name="iframesitefileupload">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
        <body>
            <form id="form1" action="IframeTest.aspx" method="post" name="form1">

                 //add stuff here ----                      

            </form>
        </body>
    </html>
</iframe>

如何将内容附加到表单元素?

How can i append contents to the form element?

推荐答案

您可以使用.contents()访问iframe:

You can get access a iframe with .contents():

$('#iframesitefileupload').contents().find('#form1')
                          .append('<div>Hello iframe</div>');

这篇关于如何在iframe表单元素内附加html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆