Cannot capture span text. Trying to return a result from a previously executed javascript

Viewed 57

I'm trying to do something in FileMaker using Webdirect that is quite difficult for me. I have added a QR code generator and code reader. I can read the code fine. The result of the QR code scan is displayed in a hidden div on my page in a span=id "outputData," which is a constant that is ran prior. After the page is displayed with the result, I need to capture that result. A user clicks a button in FileMaker and the script calls a javascript function. My JS function is trying to capture that span text. But, when I view the source, that span text is gone. Still, it shows on the webpage when viewing normally.

<div id="qr-result" hidden="">
    <b>Data:</b> <span id="outputData"></span>
  </div>

There is nothing showing the outputData in the html when viewing the source, yet the value is definitely there. Everything I have written to try to capture the contents of the span text does not work. I've literally spent 2 days and hundreds of attempts. I cannot figure out why I cannot get my value that I can see with my own eyes the webpage, but not when I view the source.

I've tried creating a function to call that will scoop up that text a thousand different ways. Could someone help me figure out how to write a function that will grab that inner text from that span text that is missing lol. Thank you for any help you can give me!

Cheers.

1 Answers

Try using the span element's innerText property. You can check that the value is what you expect by logging it to the console in your browser's devtools.

Related