Selecting a form which is in an iframe using jQuery

前端 未结 3 472
不思量自难忘°
不思量自难忘° 2020-12-11 04:59

I have a form inside an iframe which is inside a jQuery UI dialog box. The form contains a file input type. The jQuery UI dialog contains an Upload button. When this butt

相关标签:
3条回答
  • 2020-12-11 05:39

    The answer is:

    $('#upload_file_iframe').contents().find('#upload-form').submit();
    

    which I learned from http://simple.procoding.net/2008/03/21/how-to-access-iframe-in-jquery/

    0 讨论(0)
  • 2020-12-11 05:51

    Off the top of my head I'd say you might have to add the logic to the file where the iframe source is from.

    0 讨论(0)
  • 2020-12-11 05:53

    Accessing an element inside an iframe is tricky. You should use the following syntax:

    $('#iframeID').contents().find('#upload-form').submit();
    

    where 'iframeID' is obviously an ID you've given to the iframe.

    Hope it is correct!

    0 讨论(0)
提交回复
热议问题