Javascript Tooltip / Posts /

Uncaught TypeError Cannot call method appendChild of undefined

0
Hi, 

I have build a tooltip that will be included by different websites. (same concept as GA)
Now on a particular website where the code is included I cannot even get
"tooltip.pop('body', 'test'); " to work. It trows an error:  Uncaught TypeError: Cannot call method 'appendChild' of undefined
The tooltip gives me this error. I do wait for the the content of the document to be loaded. 
So just te be clear: I only get this error on a particular website. All others will show the tooltip just fine. Why is this error thrown?

Ralph  10 years ago   viewed: 5474    

9 Answers

0
Please follow http://www.menucool.com/2457/Troubleshooting-Request
Milo   10 years ago
0
Yes Milo, i did read the troubleshooting page. And did as requested. However the website is password protected and i am not able to get it available for this topic. I was hoping someone encountered the same issue. 
Ralph
  10 years ago
0
Hi, 

I found out all my problems are caused because the tooltip is not appended to the <body> tag. If I move the html of the tooltip to the end of the body tag, everything works. The append child error probably has something to do with that. What can cause the tooltip to not append at the end of the body. Am i right that the tooltip should always be appended to the body?

Thanks in advance
Ralph
  10 years ago
0
The first parameter of the tooltip.pop(...) should be an element, an element id, or null value. So you cannot write:
tooltip.pop('body', 'test') unless you have the markup of <body id="body">....</body>.
You can code it as:
tooltip.pop(document.body, 'test')
or:
tooltip.pop(null, 'test', {position: 4}) 
Milo   10 years ago
0
Thanks, but i tried that. 

No matter what element (document.body eg) it just renders at a wrong position. (Always x pixels to the right and y pixels to much down. Depends on where the Tooltip is appended.) Now this is not only a problem anymore on just one website. I have this problem on multiple developments. When i move the html with the Chrome Element inspector to the end of body the Tooltip is shown in the correct position. Do you know what else can cause the Tooltip to append to a wrong element?
Ralph
  10 years ago
0
Would you stage a simple testing page online so that I can debug?
Milo   10 years ago
0
Hi, 
You can use http://openinnavigator.dev01.gillz.nl/redirect.php. You will be redirected to the right page. Javascript file = http://openinnavigator.nl/openinnavigator.js

Be aware, the tooltip will popup as soon as you hover the link called "Dit is een link". The tooltip is set to sticky, and default should apear next to the hovered link element. (which it does not) When you click the little mail icon within the tooltip. You will open a new tooltip with {position: 4}. This also does not work. Still a wrong position. 

Thank you in advance for your help.



Ralph
  10 years ago
0
Currently the tooltip has a defect that if the page contains a form, and the form has a offset to the body, the tooltip is not positioned properly. 
Would you try out this workaround and let me know if it works?
http://www.menucool.com/3665/Wrong-Tooltip-position-if-there-is-a-positioned-form
Milo   10 years ago
0
Thanks! That solved the problem for me! The solution was to change Nb=a[h]&&a[0][o]?a[0]:kb; to Nb=kb;. Thank you for the effort!
Ralph
  10 years ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: