root Posted February 11, 2018 Share Posted February 11, 2018 (edited) Hi all, for a few days I met an error on my website, Google Chrome give me this information : Uncaught TypeError: Cannot read property 'autocomplete' of undefined at HTMLDocument.<anonymous> (ps_searchbar.js:7) at fire (core.js:sourcemap:690) at Object.fireWith [as resolveWith] (core.js:sourcemap:711) at Function.ready (core.js:sourcemap:745) at HTMLDocument.completed (core.js:sourcemap:748) (anonymous) @ ps_searchbar.js:7 fire @ core.js:sourcemap:690 fireWith @ core.js:sourcemap:711 ready @ core.js:sourcemap:745 completed @ core.js:sourcemap:748 I think there is something wrong but I can't find the problem, I used 2 days to find it, but no result. It is a little bit hard because now no JS is working... Can you help me to find what is the error? Thanks Edited February 11, 2018 by root Add: Solved (see edit history) Link to comment Share on other sites More sharing options...
root Posted February 11, 2018 Author Share Posted February 11, 2018 I solved it the problem was here because I added one line of java script code inside a TPL, and there are no error shown in prestashop... Link to comment Share on other sites More sharing options...
anamorle Posted March 22, 2018 Share Posted March 22, 2018 Hi, can you tell me how you solved? i have the same problem. Link to comment Share on other sites More sharing options...
root Posted March 22, 2018 Author Share Posted March 22, 2018 Hi, to solve my problem I just moved JS code into custom.js. Possible solutions: 1) use custom.js (path_for_your_theme/assets/js) 2) Include JS file in head.tpl file (be wareful with synchronous loading... check it on google for optimization) <script src='http://url/file.js'></script> 3) Add a JS file in your php module code, using addJS() function or maybe registerJavascript() (I have never tried it) I hope it could help Link to comment Share on other sites More sharing options...
anamorle Posted March 22, 2018 Share Posted March 22, 2018 Thanks for the reply, but I do not know how to do it. Any other clue? Link to comment Share on other sites More sharing options...
root Posted March 24, 2018 Author Share Posted March 24, 2018 What have you modified to have this error? That is The question. How to find the problem: - Have you added a new module? Try to disable it. - Have you written/changed a module? Try to disable it. - Have you edited a tpl file? Send me if possible this file, I will check the content. - Have you changed the js file content of your theme? Find modification and delete it. - Use debug mode on prestashop to have more information if it is possible, and tools of your web browser. And, just to know, what don't you know? Link to comment Share on other sites More sharing options...
anamorle Posted March 24, 2018 Share Posted March 24, 2018 (edited) Hello, thanks for the answer. I just change css or I put some style in tpl. But notice that I mark an error in ps_searchbar which never touch. I turned it off to see if it was a problem and now he gave me this error: GET https://......./modules/ajaxcart/views/js/front/pop.js net::ERR_BLOCKED_BY_CLIENT P.D: Sorry for my inglish Edited March 24, 2018 by anamorle (see edit history) Link to comment Share on other sites More sharing options...
root Posted March 24, 2018 Author Share Posted March 24, 2018 I had this error in ps_searchbar too, and in my case the problem was in a module I wrote. I think this error appears because JS is in a global error state and ps_searchbar is the first object to call something in JS. If you disable ps_searchbar, the second one will try to call a JS function (in your case ps_shoppingcart). So the problem is elsewhere. Just try to remember all modifications you've done before to get it. In any case, and if you want I can check and test your tpl file and JS files you added (or modified) recently. An other method : Comment your code, block by block and disable module one at the time until the error disappears. But it is a not recommended and a very long method if you're not lucky Link to comment Share on other sites More sharing options...
root Posted March 30, 2018 Author Share Posted March 30, 2018 Did you resolved your problem @anamorle? Link to comment Share on other sites More sharing options...
anamorle Posted May 5, 2018 Share Posted May 5, 2018 no, i still have it. Link to comment Share on other sites More sharing options...
lingmaaki Posted May 29, 2019 Share Posted May 29, 2019 On 5/6/2018 at 2:32 AM, anamorle said: no, i still have it. This error occurs in Chrome Browser when you read a property or call a method on an undefined object . Uncaught TypeError: Cannot read property of undefined error is probably easiest to understand from the perspective of undefined, since undefined is not considered an object type at all (but its own undefined type instead), and properties can only belong to objects within JavaScript. There are a few variations of this error depending on the property you are trying to access. Sometimes instead of undefined it will say null. Link to comment Share on other sites More sharing options...
marcin_jaworski Posted June 7, 2019 Share Posted June 7, 2019 https://stackoverflow.com/questions/4160257/jquery-autocomplete-data-split-is-not-a-function Link to comment Share on other sites More sharing options...
Johnmario Posted August 27, 2019 Share Posted August 27, 2019 var input1 = document.getElementById('from'); var autocomplete1 = new google.maps.places.Autocomplete(input1); var input2 = document.getElementById('to'); var autocomplete2 = new google.maps.places.Autocomplete(input2); for more information about code related visit our site:https://www.reddit.com/r/learnjavascript/comments/6uj90l/uncaught_typeerror_cannot_read_property/ or for more assistance visit Data Recovery Dubai Group Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now