0

I'm using formidable plugin to upload an image to node server, after upload is done, it returns an iframe with the corresponding message of success and its path.

I would like to retrieve this message to a string variable at client side (browser).

Iframe object

The above object is taken using var tempPath=document.getElementById('imho_id');

I've tried document.getElementById('imho_id').innerHTML; but with no success.

My confusion here is the #document part and the access to style object, i appreciate if someone could help and also briefly explain the logic of accessing document or #document.

Thank you in advance!

George Gotsidis
  • 426
  • 4
  • 15
  • I assume you want to access it in the browser, don't you? Or do you need to process in NodeJS on the server? – yunzen Sep 25 '20 at 06:48
  • @yunzen document.getElementById suggests it is not on the backend – mplungjan Sep 25 '20 at 06:51
  • Hey @yunzen, yes i would like to access at client side (browser). – George Gotsidis Sep 25 '20 at 06:53
  • Please visit the [help], take the [tour] to see what and [ask]. ***[Do some research](https://www.google.com/search?q=javascript+access+content+iframe+site:stackoverflow.com)***, search for related topics on SO; if you get stuck, post a [mcve] of your attempt, noting input and expected output using the `[<>]` snippet editor. – mplungjan Sep 25 '20 at 06:58
  • `console.log(document.querySelector('imho_id').contentDocument.querySelector('pre').textContent)` – yunzen Sep 25 '20 at 07:13
  • This has a point! but the console error is -> Uncaught TypeError: Cannot read property 'contentDocument' of null" – George Gotsidis Sep 25 '20 at 08:02

0 Answers0