0

I have this in the function for the success handler from Google Wallet (for digital goods):

var elem = document.getElementById(div1);

I checked with the debugger and the value of the variable div1 is the same as the id of the div that I see with the 'inspector' (in Firefox) so I know that it's rendered. Besides, the page is shown, and only after clicking a button does the Google Wallet popup appear.

So why is elem null? (And how do I solve this?)

ispiro
  • 26,556
  • 38
  • 136
  • 291

2 Answers2

0

Thanks to a comment by Sergio I found that the value of the variable was not the correct one - instead of being "ABC" it was "ABC ". (-With a space at the end.)

ispiro
  • 26,556
  • 38
  • 136
  • 291
-1

Perhaps a timing issue? Try placing the getElementById call inside SetTimeout a few milliseconds later?...

Code Monkey
  • 643
  • 6
  • 18