$item(...)onClick is not a function anymore

Can you share the full code on masterPage.js? If it was working, and you changed nothing at all, and it is no longer working it’s possible that you have added some other code, maybe an import, that is causing an issue with other code which runs after it. It could also explain the error with $w(elementId).hide(), since the site code JS file always runs before the page code.