Timeline for How do I fix an uncaught TypeError?
Current License: CC BY-SA 3.0
25 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 16, 2020 at 11:47 | comment | added | therobyouknow |
See also my write up about the same here: drupal.org/project/bootstrap/issues/2821008#comment-13940093 which has the added benefit of showing how my html.html.twig template looks.
|
|
Dec 16, 2020 at 0:06 | comment | added | therobyouknow |
In my case, following your tip as per your quote Jimmy Ko, and in the case of Kashmiri (+1 upvote to you, too) the <js-bottom-placeholder token="{{ placeholder_token }}"> in my html.html.twig template was inside a <div></div> and therefore not directly inside of <body></body> / a direct child. So I moved it so that it was directly inside of <body></body> / direct child, in actual fact just before the closing </body> . Result: errors gone and Drupal Core Layout Builder fully works. (I'm using Drupal 9.1).
|
|
Dec 15, 2020 at 23:38 | comment | added | therobyouknow | +1 upvote on answer "I suspect that your <script> tag is wrapped in other element. Please check your template files and remove the wrappers or check if there is a content with missing closing tag." - this helped me fix the Layout Builder for use with my custom theme. | |
May 16, 2019 at 6:23 | comment | added | Wasim Khan | In my case i was having like this <js-bottom-placeholder token="{{ placeholder_token }}"> </div> </body> </html> | |
S Sep 1, 2017 at 2:48 | history | suggested | zanvidmar | CC BY-SA 3.0 |
Missing closing tags in content are also causing this error, so I think it will be helpful that we mention this reason also in answer.
|
Aug 31, 2017 at 22:46 | review | Suggested edits | |||
S Sep 1, 2017 at 2:48 | |||||
Apr 18, 2017 at 13:10 | comment | added | Teenage | An opening < main > tag declared twice triggers the same error for me. Always check your html code with the w3c validator before starting debugging "strange" javascript errors. | |
Dec 26, 2016 at 5:28 | comment | added | Joe Hyde | Sometimes broad questions result in common errors. The common error is the footer JS tags were wrapped in an additional HTML tag. In one commenter's case, it was the <em> tag. In my case, it was a <div>. With the easy access to the theme layer via Twig, I am sure someone is going to run into the problem of "Don't wrap the Drupal footer JS tags in another HTML tag or all scripts will throw an error." This is a common problem identified by the OP's question. It is not broad at all. | |
Dec 25, 2016 at 18:36 | comment | added | avpaderno♦ | @JoeHyde The question is too broad because we cannot list all the causes of what the OP is seeing. We cannot debug a site to which we don't have access. | |
Dec 25, 2016 at 3:29 | comment | added | Joe Hyde | This question is not too broad. In any D8 install, if the footer JS tags are within ANY tag, 11 scripts will die and throw TypeError: Cannot set property... of undefined. Look at your html.html.twig and your page.html.twig templates and make sure you didn't wrap the entire page to the closing </html> page with a div. I ran into this problem using the mmenu JS flyout library that required the entire page contents to be wrapped in one div. I wrapped the footer JS tags too, and this error killed all JS on the page. So, don't wrap the bottom scripts in anything. | |
Aug 11, 2016 at 16:19 | history | edited | Jimmy Ko | CC BY-SA 3.0 |
Add some words.
|
Aug 11, 2016 at 16:18 | comment | added | Pierre.Vriens | Oeps, I had forgotten to refresh this page. Much better ... | |
Aug 11, 2016 at 16:15 | comment | added | Jimmy Ko | @Pierre.Vriens I've rephrased. Do you think it is not enough? Orz | |
Aug 11, 2016 at 13:36 | comment | added | Md. Shafiq Hossain | thanks for the info. There are lot of custom views, I am not sure where this happened. I need to check one by one. Thanks Again. | |
Aug 11, 2016 at 13:31 | comment | added | Jimmy Ko | @Md.ShafiqHossain It is very common that there is missing closing tags. I fixed this kind of problems before. It may caused by the trim function in views because it won't help you to append the closing tags correctly. | |
Aug 11, 2016 at 13:28 | comment | added | Md. Shafiq Hossain | I think the <em> tag is coming from custom views of the theme, i guess. Because due to that, site font has changed to Italic. An the js problem arises also, which I did not thought due to that. | |
Aug 11, 2016 at 13:09 | history | edited | Jimmy Ko | CC BY-SA 3.0 |
Rephrase the sentences again.
|
Aug 11, 2016 at 13:07 | comment | added | Jimmy Ko | @Pierre.Vriens Because the keywords are easily to be searched and found within Drupal core. Maybe it is easy to me but not others. Let me rephrase that. | |
Aug 11, 2016 at 11:51 | vote | accept | Md. Shafiq Hossain | ||
Aug 11, 2016 at 11:48 | comment | added | Jimmy Ko | @Md.ShafiqHossain so it explained why it only happen on live site. Because the data is different, you won't get this problem in your local. | |
Aug 11, 2016 at 11:46 | comment | added | Jimmy Ko |
@Md.ShafiqHossain I find it... </em> is missing in one of the paragraph......
|
|
Aug 11, 2016 at 11:36 | comment | added | Md. Shafiq Hossain | You are right this <em> tag creates lot of other problem. I am not sure from where it is adding. But when i view source I did not find the <em> tag, but when using Chrome Inspector, its showing. Do you know why ? | |
Aug 11, 2016 at 11:32 | comment | added | Jimmy Ko |
I can find it is wrapped within <em> when I inspect the link you provide. It is not under <footer> .
|
|
Aug 11, 2016 at 11:30 | comment | added | Md. Shafiq Hossain | I see the <script type="application/json" data-drupal-selector="drupal-settings-json"> tag is showing below the footer. I think this is added dynamically by Drupal. | |
Aug 11, 2016 at 11:13 | history | answered | Jimmy Ko | CC BY-SA 3.0 |