How to access the content of an iframe with jQuery?

iframe, jquery

Solution

You have to use the `contents()` method:

$("#myiframe").contents().find("#myContent")

Source: https://web.archive.org/web/20180608003357/http://simple.procoding.net/2008/03/21/how-to-access-iframe-in-jquery/

API Doc: https://api.jquery.com/contents/

Problem

How can I access the content of an iframe with jQuery? I tried doing this, but it wouldn't work: iframe content: `<div id="myContent"></div>` jQuery: `$("#myiframe").find("#myContent")` How can I access `myContent`? Similar to jquery/javascript: accessing contents of an iframe but the accepted answer is not what I was looking for.

Original source

Related problems