masterPage.js is for code that should run on all pages.
If you want to share code between pages then make a new public .js file and place your code there: Where Do I Put My Code?
Also this thread addresses this question:
masterPage.js is for code that should run on all pages.
If you want to share code between pages then make a new public .js file and place your code there: Where Do I Put My Code?
Also this thread addresses this question: