HI Ana,
If you are using the html snippet then I would wrap your script in a time out of 100 – 500 ms. Most likely the script is running before the page is fully loaded.
You can also try this method of implementing a script on a page.
https://forum.mendix.com/link/questions/97121
If that doesn’t work, can you provide more details on what are you trying to do? Are you trying to disable an a set of checkboxes based on another selection?