You should replace both = signs, with ===
If you see that error message, it would seem you already have added a button that starts this code on click?
Otherwise, these are the steps:
You should place a button on your page, with the ID #button1
You can set this by right mouse on the button > View Properties
(If it’s the first button on your site, it will be already #button1)
In the same properties panel you should also click the + sign next to onClick to add a hook.
Now your function is connected to the button. There is no dataset involved.