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

Alright, I’m trying to edit the theme instead and have put this javascript in my </head> section

<script>
    document.getElementsByClassName(".sign-up-button").onclick = function () {
        console.log('this should print');
    };
</script>

But when ever I click it it does not show in the console.

I’ve also tried variations, it does show the element but no actions of the js are working on it such as

<script>
    var thingy = document.getElementsByClassName("sign-up-button");
    console.log(thingy);
    thingy.onclick ="return false;"
    thingy.onclick = function() {
        window.location.href = "https://join.example.com";
    };
    console.log(thingy);
</script>