Redirect all users who click on domain.com/signup to a different page

I still can’t seem to get this to work as it seems even if I put the script in the </body> of the admin pane, it still always shows the length as 0 of the html collection. I suppose it’s because it’s firing before the document is fully loaded?

<script>
    var thingy = document.getElementsByClassName("sign-up-button");
    console.log(thingy.length)
    for (var i = 0; i < thingy.length; i++) {
            console.log('pring this');
    };
</script>

Any help would be apprecicated