Cannot read properties of null

I am trying to add the code on this page: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_filter_elements

but it give me an error on the js:

Uncaught TypeError: Cannot read properties of null (reading ‘getElementsByClassName’)
at main.js?ver=5.8.2:35

I am trying to add it on: https://nuovosito.lealternative.net/test-browser-4/

It seems works fine expect that it can’t find and active class to the current button.