[removed] document.getElementById() returns NULL

后端 未结 7 2145
遥遥无期
遥遥无期 2021-01-02 01:23

I am quite new with Javascript and I got a problem with document.getElementById() that always returns NULL, and that\'s driving me nuts.

I have a element in my code

7条回答
  •  [愿得一人]
    2021-01-02 01:44

    You never checked getElementById(...) for NULL.

    You checked getElementById(...).value for NULL, and divs don't have a "value".

    Also note that you forgot to close that

    tag, which is illegal in your XHTML... and used an SVG doctype for some reason. SVG is not HTML.

    It's not really clear what you're trying to do here.

提交回复
热议问题