```
HTML:   

    <script type="text/javascript">
            invis();
          </script>

          <div id="cok" class="cookiesTXT">
            <h2>Diese Seite nutz Cookies, unsere Cookie Richtlinien finden sie <a href="/cookies">hier</a>
            <br> Sind sie damit einverstanden? </h2>
            <button type="button" name="button" onclick="accept()">Akzeptieren</button>
            <button type="button" name="button" onclick="invis()">Ablehnen</button>
          </div>

    JavaScript:

    function invis(){
      document.getElementById("cok").style.display = "none";
    }

```

If I open the Site the function invis is not working and the div isn't invisible, but if I click the last Button labeled "Ablehnen" then the function invis work well

Why is this, and how can I make this work ?