I am working on a project(a simple website). This website has multiple pages.I have a question: For example, if I am on page "index.html", I get this error for the dom element which is on another page "blog.html" and the code after the part where I got the error does not work: "Uncaught ReferenceError: context_text is not defined".
I solved this problem for the parts where I got errors as follows: if(content_text != null){ x.addeventListener... }
but I don't think this is the right solution. my question is: what is the right solution for this problem? another question: should i create separate .js files for each page?
Comments
Post a Comment