Support » Plugin: Very Simple Contact Form » TypeError: document.getElementById(…) is null

  • Resolved sebas6691

    (@sebas6691)


    I’m getting this error in my console everywhere:
    TypeError: document.getElementById(…) is null

    The error line:
    <script type=”text/javascript”>document.getElementById(“vscf-anchor”).scrollIntoView({behavior:”smooth”, block:”center”});</script>

    How to solve this?
    Thank you in advance!

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Guido

    (@guido07111975)

    Hi,

    That’s not nice. Have to look into this, but right now I think it has something to do with the form anchor (option “Scroll back to form position after submit”) being present at your form or not. Will keep you informed.

    Guido

    Plugin Author Guido

    (@guido07111975)

    Hi again,

    It should be fixed in new version. Could you please tell me the outcome after you’ve updated plugin?

    Guido

    sebas6691

    (@sebas6691)

    Hi Guido,

    Thank you for looking into this!
    I’ll let you know if it is resolved!

    Best,
    Sebastiaan

    sebas6691

    (@sebas6691)

    Jup it’s fixed!
    Thanks!

    Plugin Author Guido

    (@guido07111975)

    Great! Marking this thread as resolved.

    Guido

    This error TypeError: document.getelementbyid(…) is null would seem to indicate that there is no such element with an ID passed to getElementById() exist. This can happen if the JavaScript code is executed before the page is fully loaded, so its not able to find the element. The solution is that you need to put your JavaScript code after the closure of the HTML element or more generally before < /body > tag.

    Plugin Author Guido

    (@guido07111975)

    Hi,

    In this case the “element” is only active (being used) if scroll to anchor is set to true, so I forgot to check for it’s presence.

    Guido

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘TypeError: document.getElementById(…) is null’ is closed to new replies.