Search code examples
javascriptfirefox-addondownloadrapidshare

Cannot get element value even though it it exists on page


I am working on a javascript downloader and need to click a button. I can see the button and get it's values with web developer and dom inspector in FF. But when I try to:

var freeUserForm = this.iFrame.contentDocument.getElementById('js_free-download_btn');

It returns null and when I view the page source the element is not there. So what's going on?

Thank you very much, Todd


Solution

  • (assuming that the ID of the IFRAME element is "foo")

    var iframe = document.getElementById("foo");
    var freeUserForm = iframe.contentDocument.getElementById("js_free-download_btn");