Can someone explain this to me. I have 1 js file on my site, using mainly jQuery, all my js code uses elements that are on all pages, EXCEPT for 1 js code that targets an element that is only on one page.
So when I go to that one page, I get no JavaScript errors, however when I go to any other page it gives me a $..Undefined
error for that element. I am using a .offset().top
code for that element. I'm assuming that's because if you only target an element that's on one page I should just include a script on that page alone and not put it in my js file??? Does that include all jquery functions or just something specific to using .offset()
and/or others? Is my assumption correct?