Home > front end >  Javascript obj. Inside the onclick=function () {} why cannot be defined
Javascript obj. Inside the onclick=function () {} why cannot be defined

Time:10-02

In the window. The onl oad and inside & lt; \ body> Before didn't also the way to solve the

CodePudding user response:

This error is that your obj value is null, the elements have no access to success,
If in the window. The onl oad and inside & lt;/body> Front also not line, may be an id or class name spelling errors,
If use the document. QuerySelector (), note id or class name in front of the "#" or ". "

CodePudding user response:

If it is to use innerHTML dynamically generated elements, to add elements to the page with the document. Only after the getElementById (),

CodePudding user response:

reference 1/f, the sky wave response:
this error is that your obj value is null, the elements have no access to success,
If in the window. The onl oad and inside & lt;/body> Front also not line, may be an id or class name spelling errors,
If use the document. QuerySelector (), note id or class name in front of the "#" or ". "

Thank you, back in the evening have a try

CodePudding user response:

reference 1/f, the sky wave response:
this error is that your obj value is null, the elements have no access to success,
If in the window. The onl oad and inside & lt;/body> Front also not line, may be an id or class name spelling errors,
If use the document. QuerySelector (), note id or class name in front of the "#" or ". "

Is really ID a spelling mistake
  • Related