Languages

Menu
Sites
Language
getElementById in two different pages.

Hi,

I have 2 html files where I need to access.

So I want to use 'getElementById' in first file, and want to do same thing in second file.

Accessing first file is ok, there is no problem because it is index.html file.

But I cannot access second page's element.

How can i getElementById in second file.

 

This is error message : app.js (101) :TypeError: 'null' is not an object (evaluating 'authButton.addEventListener')

 

Edited by: 승민 백 on 08 Jun, 2017

Responses

3 Replies
Marco Buettner

Did you bind the .js file correct?

André Reus

hi 승민 백

I tried it. May be this will not work in this way. Use 2 different js for 2 different html. This works for me. And let me know if you found any other solution. 

승민 백

Thanks for your replies.

I solved problem like you.

But I use 1 js and 1 html, I just devided 1 html file to several pages.

Still.. I have some problem but it works :)